In Oracle APEX, long column names in Interactive Grids often make the headers look cluttered or misaligned. Many developers manually insert <br>
tags in the column headings to fix this — but that’s time-consuming and hard to maintain.
Here’s a smarter and cleaner way!
With a small JavaScript snippet, you can automatically wrap column headers wherever you want — simply by adding an underscore (_
) in the column name. The script detects these underscores and replaces them with line breaks (<br>
), giving you perfectly wrapped headings without touching the HTML.
Just add this script to the Page Load event, and your column headings will format themselves dynamically based on the number of underscores. Clean, flexible, and maintenance-free!
$("#EMP th span.a-GV-headerLabel").each(function() { // Emp - static id of the IG
let text = $(this).text();
if (text.includes("_")) {
$(this).html(text.replace(/_/g, "<br>"));
}
});
Comments
Post a Comment