All Components

composeSortDescriptors

Converts the SortDescriptors to a Comparer function that can be used via Array.sort.

If multiple descriptors are provided, sorting is applied in a right-to-left order.

import { composeSortDescriptors } from '@progress/kendo-data-query';

const data = [{ name: "Pork" }, { name: "Pepper" }, { name: "Beef" } ];
const comparer = composeSortDescriptors([{ field: "name", dir: "asc" }]);
const result = data.sort(comparer);
//output: [{ name: "Beef" }, { name: "Pepper" }, { name: "Pork" }];
In this article