The ON SORT interfaction block can be used to detect when rows have to be sorted
in a DISPLAY ARRAY or INPUT ARRAY dialog.
ON SORT is used in two different contexts:
- In a regular DISPLAY ARRAY / INPUT ARRAY dialog
(not using paged mode), the ON SORT trigger can be used to detect
that a list sort was performed. In this case, the (visual) sort is already done by
the runtime system and the ON SORT block is only used to execute
post-sort tasks, such as displaying current row information, by using arrayToVisualIndex() dialog
method. It is also possible to get the sort column and order with the getSortKey() and
isSortReverse() dialog methods.
- In a DISPLAY ARRAY using paged mode (ON FILL
BUFFER), built-in row sorting is not available because data is provided by
pages. Use the ON SORT trigger to detect a sort request and perform
a new SQL query to re-order the rows. In this case, sort column and order is
available with the getSortKey() and isSortReverse() dialog methods. See Populating a DISPLAY ARRAY.