In Oracle APEX, Interactive Reports offer a powerful way to organize and display data. One often-overlooked enhancement is styling column groups and their corresponding columns to improve visual clarity and user experience.
This blog guides you through how to color column group headers and their underlying columns using both CSS and JavaScript.
Step 1: Assign a Static ID to the Interactive Report
-
Open your APEX page in Page Designer.
-
Select the Interactive Report region.
-
Under the Advanced section, set the Static ID
This ID helps us target the report with custom code.
Step 2: Identify Column Groups You Want to Style
Suppose you want to color these column groups:
-
End Item Info
-
Sales Info
To identify them:
1. Run the page and open the browser’s Developer Tools (Right-click > Inspect)
data-idx
(e.g., data-idx="1"
for End Item Info, data-idx="2"
for Sales Info).To color only column groups Now go to Page and below code inline
#my_ig .a-GV-headerGroup[data-idx="1"] {
background-color: #cdcdcd;
}
#my_ig .a-GV-headerGroup[data-idx="2"] {
background-color: #31869b;
}
Step 3: Use JavaScript to Apply a Class to Each Column
You can assign CSS classes to all columns under a specific group using the Column Initialization JavaScript Function.
📍Go to:
-
Page Designer → Interactive Report → Advanced
-
Set the Column Initialization JavaScript Function to:
function(config) {
config.defaultGridColumnOptions = {
headingCssClasses: "SalesInfo"
}
return config;
}
EndItemInfo
to certain columns), go to individual columns → Appearance → CSS Classes, and manually set them as needed.Step 4: Add Final CSS to Style Groups and Columns
Now, go to the Page Designer → CSS > Inline section, and paste the following CSS code:
EndItemInfo
and SalesInfo
.
0 Commentaires