Skip to main content
Version: 11.2

Rowset.sort()

note

This article is about the sort() function of the Rowset object.

Rowset.sort()

Sorts the rows in the row set according to the sort definition set by sortOrder().

Returns a UdbPromise object with the UdbRowSets object as parameter.

Syntax

$.udb( *ds* ).rowSet( *rowSet* ).sort( *options* )
.then( ( *row-set* ) => {
// success
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});

*options* ::= {
[target]: *target*
}

*target* ::= { 'client' | 'server' | ['auto'] }

The required ds parameter is a data source selector.

The required rowSet parameter is a rowset identifier.

Target is a string that determines where the sorting should take place. If it is 'client', the existing rows are re-sorted locally. If it is 'server', the row set is re-queried so the server performs the sort. If it is 'auto' (the default), sorting is done on the server, except when a user-defined sorting function has been specified for one of the sort columns, in which case sorting is done on the client.

Example

$.udb('EMP').sortOrder({ order: 'NAME' });
$.udb('EMP').rowSet('current').sort();
EventApplies toOccurs when
showdataData source objectsNew data is available for display.