docs

Sorting

The OData V4 model supports server-side sorting on lists.

To use server-side sorting, set the operation mode to sap.ui.model.odata.OperationMode.Server, as described in Filtering.

ODataListBinding allows to set static and dynamic sorters:

Dynamic sorters are transformed to an OData $orderby system query option value, and the static sorters are always appended as secondary sort criterion. In the example below, the equipments are first ordered by Category (dynamic sorter that can be overwritten by calling sort on the list binding, Line 9) and then by Name (secondary sort criterion, static sorter, Line 6). For information on the optional group property (Line 11), see Sorting, Grouping, and Filtering for List Bindingand the vGroup parameter of sap.ui.model.Sorter.

Example: Dynamic and static sorters

1  <Table growing="true" growingThreshold="5" id="Equipments"
2      items="{
3              path: '/Equipments',
4              parameters: {
5                  $$operationMode: 'Server',
6                  $orderby: 'Name',
7                  $select: 'Category, EmployeeId, ID, Name'
8              },
9              sorter: {
10                 path: 'Category',
11                 group: true
12             }
13     }">

Related Information

API Reference: sap.ui.model.Sorter