Oracle APEX交互网格:按返回值对选择列表列进行排序
Yes, you absolutely can configure your interactive grid to sort by the select list's return value (the numeric 1-7 values) instead of the Dutch day abbreviations. Here's how to implement it step by step:
1. Verify Your Underlying Data Setup
First, double-check that your database table stores the numeric return values (1 for Ma, 2 for Di, etc.) — this is the value mapped to r in APEX's {d: 'Ma', r: '1'} object. If your table already uses these numeric values, you're good to go; if not, you’ll need to adjust your data model to store these numbers instead of the abbreviations.
2. Adjust Column Sort Settings (Simplest Method)
Navigate to your interactive grid's column configuration:
- Go to the Columns tab of your interactive grid component.
- Select the column with the Dutch day abbreviations.
- Switch to the Advanced sub-tab, then find the Sorting section.
- In the Sort Expression field, replace the default display value reference with the name of your database column that holds the numeric return values (e.g.,
DAY_OF_WEEK_NUM). - Save your changes and run the page to test the sorting behavior.
3. Alternative: JavaScript Override (For Dynamic/Computed Values)
If the above method doesn’t fit your setup (like using a dynamic LOV or computed display values), you can override the sort behavior with JavaScript:
- Go to your page’s JavaScript section (under Page Properties).
- Add this code to the Execute When Page Loads attribute:
$(document).ready(function() { // Target your interactive grid by its static ID const igWidget = apex.region("YOUR_IG_STATIC_ID").widget(); const igGridModel = igWidget.interactiveGrid("getViews", "grid").model; // Override the sort comparator for your target column igGridModel.sortComparators["YOUR_COLUMN_STATIC_ID"] = function(a, b) { // Extract the numeric return values (r) from the column's data object const valA = parseInt(a[0].r); const valB = parseInt(b[0].r); return valA - valB; }; });- Replace
YOUR_IG_STATIC_IDwith your interactive grid’s static ID. - Replace
YOUR_COLUMN_STATIC_IDwith the static ID of your day-of-week column.
- Replace
Test the Sort
After applying either method, click the column header’s sort arrows — your grid should now sort days in the correct logical order (Ma → Di → Wo → Do → Vr → Za → Zo) based on the numeric return values, not the alphabetical order of the abbreviations.
内容的提问来源于stack exchange,提问作者HotFix

