New to Kendo UI for Angular? Start a free 30-day trial
composeSortDescriptors
Converts the SortDescriptors
into a Comparer function that can be used through Array.sort
. If multiple descriptors are provided, sorting is applied in a right-to-left order.
ts
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" }];
Parameters
descriptors SortDescriptor[]
The descriptors which will be converted.
Returns
Comparer - The produced function.