🔒 Implement Sticky Columns for Classic Reports Without Plugins
🚩Introduction
In real-world Oracle APEX applications, Classic Reports often become wide due to data-heavy requirements. Horizontal scrolling is common, but since Classic Reports do not provide a built-in column freezing option, important reference columns such as IDs or names scroll out of view, affecting readability and usability.
This limitation can be addressed by implementing custom column freezing using JavaScript and CSS without any Plugins. By fixing key columns, Classic Reports become easier to navigate and offer a spreadsheet-like, enterprise-friendly user experience.
📑 Why Column Freezing is Needed in Classic Reports
In data-intensive applications, reports often extend horizontally due to the number of attributes required for business analysis. While horizontal scrolling allows access to all columns, it introduces a usability challenge: users lose sight of key reference information when navigating across the report.
To keep important columns (like Name, ID, or Code) always visible
-
To avoid losing track of rows while scrolling horizontally
-
To make wide reports easier to read and understand
-
To reduce repeated left / right scrolling
-
To compare data across many columns without confusion
👉 Steps to create Column Freezing in Classic Report
Step 1:
Step 2:
Step 3:
function freezeCR(){
const colWidths = [];
const numCols = 2; // No. of Columns to be freezed in the report
// Collecting column widths
for (let i = 1; i <= numCols; i++) {
colWidths[i] = $(`#RG_EMP .t-Report-report tr th:nth-child(${i})`).width();
}
// Reset all columns first | #RG_EMP => Static ID
$(`#RG_EMP .t-Report-report tr th,
#RG_EMP .t-Report-report tr td`).css({
"position": "relative",
"left": "",
"z-index": "",
"background": ""
});
// Setting styles
for (let i = 1; i <= numCols; i++) {
let leftOffset = 0;
for (let j = 1; j < i; j++) {
leftOffset += colWidths[j];
}
$(`#RG_EMP .t-Report-report tr th:nth-child(${i}),
#RG_EMP .t-Report-report tr td:nth-child(${i})`).css({
"position": "sticky",
"left": leftOffset + "px",
"background": "white",
"z-index": "3"
}); //css styles for freezing the column
}
}
Step 4:
function freezeCR(){ const colWidths = []; const numCols = 2; // No. of Columns to be freezed in the report // Collecting column widths for (let i = 1; i <= numCols; i++) { colWidths[i] = $(`#RG_EMP .t-Report-report tr th:nth-child(${i})`).width();
} // Reset all columns first | #RG_EMP => Static ID $(`#RG_EMP .t-Report-report tr th,
#RG_EMP .t-Report-report tr td`).css({
"position": "relative", "left": "", "z-index": "", "background": "" }); // Setting styles for (let i = 1; i <= numCols; i++) { let leftOffset = 0; for (let j = 1; j < i; j++) { leftOffset += colWidths[j]; } $(`#RG_EMP .t-Report-report tr th:nth-child(${i}),
#RG_EMP .t-Report-report tr td:nth-child(${i})`).css({
"position": "sticky", "left": leftOffset + "px", "background": "white", "z-index": "3" }); //css styles for freezing the column
} }







Comments
Post a Comment