Easy sorting of tables in SAP

Introduced in Neptune DXP - SAP Edition 6.1

You can enable table sorting of a sap.m.Table with a simple setting in the App Designer. Columns will be sortable with an intuitive click in the column header and a mouseover effect indicates that a column can be sorted. Sorted columns will get a sort icon next to the column header.

Table Configuration

  • neptuneSorterEnable: Enable sorting. Only setting needed if you just want default sorting on all columns.

  • neptuneDefaultColumn: Set default sorting column. If left empty, the first column will be the default sorting column.

  • neptuneDefaultColumnDirection: Set default sort direction on default column. It left empty, default sort direction will be ascending.

sap edition table sort config

Column Configuration

  • neptuneCustomSorter: Create custom sorter. Leave empty to sort by the bound value field or custom sort field.

  • neptuneCustomSortField: Custom sort field. Leave empty to sort by bound value field.

  • neptuneSorting: Leave empty to set "Both" and get full sorting:

    • Ascending: Only ascending sorting on this column.

    • Descending: Only descending sorting on this column.

    • Both: Ascending & Descending sorting on this column.

    • None: Turn off sorting for this column.

sap edition colum sort config

Easy Table Sorting Example

Here the second column is as default, with default direction set to descending. First row is not sortable. The text object in the last row, is bound to postal code and city from the ABAP backend. The column has a custom sort field set to city.
When a non-default column is clicked, it is sorted ascending (unless only descending is allowed). When the column is clicked again, the column is sorted ascending (if the column is set to sort both ascending & descending). When the column is clicked a third time, the sorting is set back to the default sorting field/direction.

sap edition table sort example

Example of a custom sorter. Input to the event handler is the event object e:

e: {
    field: Binding field -> Either the bound value or the field set in neptuneCustomSortField
    descending: Boolean -> true if descending is chosen, false if ascending

sap edition table custom

sap edition table custom2