setSortFields( ) method
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Specifies or clears the record fields on which to automatically sort the record objects for
a table reference after you have set its autoSort property to
true (the default).
This method enables or disables automatic sorting based on record fields only for supported
JSDO operations. See the description of the autoSort property for more
information.
Return type: null
Applies to: progress.data.JSDO class, table reference property (JSDO class)
Syntax
|
- jsdo-ref
- A reference to the JSDO. You can call the method on jsdo-ref if the JSDO has only a single table reference.
- table-ref
- A table reference on the JSDO.
- sort-fields
- An array of
stringvalues set to the names of record fields on which to sort the record objects, with an optional indication of the sort order for each field. This array can have the following syntax:
If you set the sort-fields parameter to null, or you
specify an empty array, the method clears all sort fields. Automatic sorting for the table
reference can then occur only if there is an existing sort function setting using the
setSortFn( ) method.
setSortFn( ) in addition to using this method to set sort fields, the
sort function takes precedence.Example
In the following code fragment, assuming the autoSort property is set to
true on dsCustomer.eCustomer (the default), after the
fill( ) method initializes JSDO memory, the record objects for
eCustomer are sorted by the Country field ascending,
then by the State field within Country ascending, then by
the Balance field within State descending. At a later
point, the foreach( ) method then loops through these record objects,
starting with the first record in eCustomer sort order:
|
See also:
autoSort property, caseSensitive property, setSortFn( ) method, sort( ) method