The "field name sort response" property works for a grid that has fields in the columns--a Profound UI handler-driven grid. The grid would also be a paging grid. (If the grid loads all records at once, then the client-side code should be used to handle sorting.)
Suppose you bind "field name sort response" to a field named
sortField. You also have a variable, say,
prevSortField, which gets set to whatever the sorted field column is. After a user clicks a column to sort, then in RPG,
sortField gets filled with the name of the field that is in the column that was clicked. When ExFmt returns control to your program, you'd check to see if
sortField is different from
prevSortField. If the two variables are different, then the sort column changed, and you'd update your sorting SQL as well as
prevSortField. If the variables are the same, then you'd change the direction of the sorting. That is, if the sort direction was ascending, then you'd change your SQL to sort descending.
To get the arrows to display, you'd also need to bind to "default sort order" and "initial sort field".
iconField below is a 25-character field.
iconAscend is bound to an indicator:
- iconAscend.png (35.33 KiB) Viewed 568 times
In RPG after ExFmt, you would set
iconField to
sortField when
sortField is not empty. The "initial sort field",
iconField , is what tells the grid which column to place the arrow in.
The "default sort order",
iconAscend, tells the grid which direction to point the arrow. In RPG, iconAscend is used to determine if the SQL should sort Ascending or Descending. The value of
iconAscend should toggle whenever the same sort column is clicked. If a different sort column is clicked, then you can set
iconAscend On or Off, depending on how you want to start the sort, ascending or descending.