Sort Order
Sort Order
By default, the DataSource reads data records using a default record order specific to the table and database server. Typically, the database uses primary keys or indices to determine the default order. If the records must be read in a specific order, you can add one or more sort fields to the DataSource.
// ASC sort by a main table field
ds.addSort("dp_id");
// ASC sort by a standard table field
ds.addSort("em", "phone");
// DECS sort a main table field
ds.addSort("wr", "dp_id", DataSource.SORT_DESC);
To clear previous sort order fields, invoke this method:
ds.clearSort();