If your application includes a GridControl that is associated with a DataSet, you can sort on a single column in the grid by clicking the column header in the running application. Click again to toggle from ascending to descending order. You can disable this feature by setting the sortOnHeaderClick property to false.
If you need your application to sort in a specified order, the JBuilder visual design tools allow you to quickly set these properties. The Sort property editor dialog provides an easy way to
To set sort properties using the JBuilder visual design tools:
The property values you specify in this dialog are stored in a SortDescriptor object.
You can enter the code manually or use JBuilder design tools to generate the code for you to instantiate a SortDescriptor. The code generated automatically by the JBuilder design tools looks like the following:
queryDataSet1.setSort(new borland.jbcl.dataset.SortDescriptor(
new String[] {"EMP_NO","LAST_NAME","FIRST_NAME" }, true, false));
In this code segment, the SortDescriptor is instantiated with sort columns of employee number (EMP_NO), then the last and first names (LAST_NAME and FIRST_NAME), case insensitive, and in ascending order.