Skip to content

extendedSort

Compare
Choose a tag to compare
@komarovalexander komarovalexander released this 16 Mar 22:08
· 275 commits to master since this release
9358d23

#241
extendedSort allows fully customize sort logic, as a result you can use any extended sorting library, to implements different sort cases, such as MultipleSorting and others..

      extendedSort={(data, columns) => {
        let sortedColumns = columns.filter(c => c.sortDirection);
        if (sortedColumns.length === 0){
          return data;
        }
        sortedColumns = orderBy(sortedColumns, ['sortIndex'], ['asc']);
        const iteratee = sortedColumns.map(c => c.key);
        const order = sortedColumns.map(c => c.sortDirection === SortDirection.Ascend ? 'asc' : 'desc');
        return orderBy(data, iteratee, order);
      }}
      sortingMode={SortingMode.MultipleTripleStateRemote}

demo: https://komarovalexander.github.io/ka-table/#/sorting-extended