Home > Software engineering >  Oracle APEX - Interactive Grid - Sorting Select List column on return value
Oracle APEX - Interactive Grid - Sorting Select List column on return value

Time:01-20

I have a Select List column in an Interactive Grid. It displays abbreviated days of the week (in Dutch):

  • Ma - 1
  • Di - 2
  • Wo - 3
  • Do - 4
  • Vr - 5
  • Za - 6
  • Zo - 7

And so on...

If we now sort on this column, it is sorted on its display value rather than the return value.

I know that APEX uses an object to display this as follows:

{d: 'Ma', r: '1'}

Is it possible to sort a Select List column on its return value rather than the display value?

CodePudding user response:

Why bother changing the rendered page ? It is a lot simpler to use a sql select statement as source for the select list. That gives you all the flexibility you want:

WITH dotw (dayabbr, nr) AS
(
SELECT 'Ma',1 FROM DUAL UNION ALL
SELECT 'Di',2 FROM DUAL UNION ALL
SELECT 'Wo',3 FROM DUAL UNION ALL
SELECT 'Do',4 FROM DUAL UNION ALL
SELECT 'Vr',5 FROM DUAL UNION ALL
SELECT 'Za',6 FROM DUAL UNION ALL
SELECT 'Zo',7 FROM DUAL 
)
SELECT 
  dayabbr AS d, 
  nr AS r FROM dotw 
ORDER BY nr

D   R
Ma  1
Di  2
Wo  3
Do  4
Vr  5
Za  6
Zo  7

CodePudding user response:

In the definition of your LOV (Shared Components > List of Values) you can define the order.

If you are using a static list of values, you would need to specify the Sequence column for the order that you want them to appear.

Static LOV

If you are using a dynamic LOV, you can specify the sort order that the list is rendered in.

Dynamic LOV

  •  Tags:  
  • Related