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 unter 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 this example, the equipments are first ordered by Category (dynamic sorter) and then by Name (secondary sort criterion, static sorter). For a description of the group property, see getGroup.

Example: Dynamic and static sorters

#js
<Table growing="true" growingThreshold="5" id="Equipments"
    items="{
            path : '/Equipments',
            parameters : {
                $$operationMode : 'Server',
                $orderby : 'Name',                             <-- static sorter
                $select : 'Category,EmployeeId,ID,Name'
            },
            sorter : {                                      <-- dynamic sorter; can be overwritten by calling sort on the list binding
                path : 'Category',
                group : true                                <-- optional, see parameter vGroup of sap.ui.model.Sorter
            }
        }">

In this example, the equipments are first ordered by Category (dynamic sorter) and then by Name (secondary sort criterion, static sorter).