You want to know how to use the sorting attribute of a grid-view control.
The grid-view control in G2 shows a grid that contains multiple columns and rows of cells, which can contain read-only and editable cells and multiple data types such as integer, quantity, text-box, check-box, combo-box, color-picker, duration, calendar, time-of-day, spinner, and image. This control supports the sorting of columns.
When the sorting attribute is set to true, clicking the column header displays an arrow for sorting the values in ascending or descending order. When sorting in ascending order, numbers precede uppercase letters, and uppercase letters precede lowercase letters. Numeric sorting only works if all cells in the column contain cells of type integer or quantity.
To see an example of how this is implemented, download the KB attached to this article and in G2:
- Load the grid-view-sorting.kb KB.
- Go to Simple Examples of Custom Dialogs.
- Open GRID-VIEW-SORTING.