Custom Sort Demo

The Custom Sort function allows you to specify a bespoke custom sort order when a column is sorted (in place of the default alphabetical or numbered sort).

This is ideal for columns where the default sort order doesnt make sense (e.g. a 'Ratings' or 'Tenor' column) where you will want to provide a standard non-alphabetical sort.

It is also suitable for columns where some users might have their own preferred non standard sort (e.g. a 'Sector' column).

There is no limit on the number of Custom Sorts applied in a Layout but each Column can only have one Custom Sort.

A Custom Sort can be defined in 2 different ways; both of which will be used to sort the column when the header is clicked:

  • A 'hard-coded' list of sorted values in Custom Sort Predefined Config
    This is what we provide for the Contact and Ship Via columns in this demo.

  • A JavaScript comparer function via the columnSortComparers property in General Options
    The Employee column in this demo uses a comparer function which will sort by Last Name (see the code below).

Custom Sorts will be applied by AdapTable whenever sorting is required, e.g. when:

  • Row Grouping - run the 'Grouping Layout' to see Employee row grouped and sorted using the Custom Sort comparer
  • Pivoting - run the 'Pivoting Layout' to see Employee pivoted and sorted using the Custom Sort comparer

Generating dummy data, please wait ...