SORT-TYPES (alphanumeric)

SORT-TYPES is an alphanumeric property that can be repeated for each column contained in the grid. The value determines the sorting property of the column as shown in the table. Many of these values are similar to those for the DATA-TYPES property.

Value Meaning
- Not sortable. This is the default. Any value other than the ones described below also prevents sorting on the column.
X Alphanumeric sorting, case-insensitive
U, L Alphanumeric sorting, case-sensitive
A Not implemented, reserved for future use
9, N Numeric sorting, leading sign and current decimal-point used, all other non-digit characters ignored
Z Not implemented, reserved for future use
I Integer sorting, leading sign used, all other non-digit ignored
P Positive integer sorting, all non-digit characters ignored
D, E Date sorting. Assumes three integer fields separated by one or more non-digit characters. Integers are year, month and day. Two-digit years less than 30 are treated as year 20xx while other two-digit years are treated as year 19xx.

The default ordering of the fields is month, day, year if the current decimal point character is a point or period (.), otherwise the default ordering is day, month, year. You can explicitly specify the ordering by appending a three-character string enclosed by parenthesis, using Y, M and D to represent the year, month and day respectively. For example, D(YMD) is date order, with the date being in year-month-day order.

Invalid format strings have undefined results. Only MDY, DMY and YMD are currently valid.

Equivalent lowercase letters may substitute for any of the formats above.

The default sort ordering is ascending. You may specify the default order as descending by appending a caret (^) to the SORT-TYPES value. For example A^ specifies a descending alphanumeric sort. Optional elements may be specified in any order. For example D^(MDY) and D(MDY)^ both specify a descending date field using the month-day-year ordering.

Ascending/descending order only determines the sort order when the user first clicks on the column. After that, the user can reverse the ordering by clicking again. The current order is indicated by the triangle or arrow indicator displayed next to the column title; you can configure the type of indicator using the GRID_SORT_INDICATOR configuration variable.

Alphanumeric ordering is done using the current language sort order on the client machine as defined by the operating system (i.e. Windows).

The user requests the sort by clicking on the column header. A grid must have column headings in order to be sorted by the user.

Events

MSG-BEGIN-SORT - Generated when the user clicks on the heading of a sortable column. EVENTDATA-1 contains the column number. EVENT-ACTION determines how the control responds:

  • EVENT-ACTION-NORMAL (default) - The grid's records are sorted by the column.
  • EVENT-ACTION-COMPLETE - Nothing further happens. Use this to provide a custom sort procedure by emptying the grid and reloading it in the desired order.
  • EVENT-ACTION-FAIL - Same effect as EVENT-ACTION-COMPLETE.

MSG-FINISH-SORT - Generated with the grid has completed a sorting operation. EVENT-DATA-1 contains the column number used to sort and EVENT-DATA-2 contains the record number of the last row of data in the grid. Use this to re-synchronize a data source's position for a paged grid.

Note: Grid sorting uses quicksort to sort the columns. While this is very fast, it is known that quicksort is not a stable sorting algorithm. Stable sorting algorithms maintain the relative order of records with equal keys. Since quicksort is not a stable sorting algorithm, sorting on one column and then a different column does not necessarily keep the original column in sorted order (for those rows that have duplicates in the different column).

Also, because rows are not necessarily in the order they were placed into the grid, use the NEXT, PREVIOUS, NEXT PAGE, and PREVIOUS PAGE events with care. And the TOP and END events may show unexpected rows. This is because all of these events assume that the grid rows are in the original order (the order you placed them into the grid originally). Care must be taken when using the SORT property on paged grids to avoid confusing your users.