You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Oracle APEX交互网格:按返回值对选择列表列进行排序

Solution: Sort Interactive Grid Select List Column by Return Value

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_ID with your interactive grid’s static ID.
    • Replace YOUR_COLUMN_STATIC_ID with the static ID of your day-of-week column.

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 10:19:06