.sortOrder()

Previous Next

Sets or removes a sort definition. A sort definition is a column or a list of columns by which data is sorted as well as (in the case of a list of columns) the hierarchy of these sort columns, i.e., by which column the data is sorted first, second...

Returns the 'this' object.

Syntax

.sortOrder( options )

 

options  ::=  {

     order: order

,    resetOrder: reset-order

,    resetFn: remove-fn

}

 

reset-order  ::=  { none | clear | default }

remove-fn  ::= { true | false }

Order is an array of objects or an array of columns that specify the sort definition.

Reset-order is a string that specifies what should happen with the existing sort definition. If reset-order is set to 'none' (the default), new sort columns are added in front of existing sort columns. If it is set to 'clear', the existing sort definition is removed. If it is set to 'default', the existing sort definition is replaced by the sort definition that was specified by setting the Sort Order property for the data object in Web Designer.

Remove-fn is a boolean that determines whether user-defined sorting functions must be removed. The default is false.

Examples

If the existing sort order was by NAME, the result of each of the following examples is that data is sorted first by DEPT_NO and then by NAME:

$.udbMeta('EMP').sortOrder({

   order: 'DEPT_NO',

   resetOrder: 'none'

});

 

$.udbMeta('EMP').sortOrder({

   order: ['EMP_NO', 'NAME'],

   resetOrder: 'clear'

});