New to Kendo UI for Angular? Start a free 30-day trial
orderBy<T>
Orders the specified array according to the provided sort descriptors.
ts
import { orderBy } from '@progress/kendo-data-query';
const data = [
{ name: "Pork", category: "Food", subcategory: "Meat" },
{ name: "Pepper", category: "Food", subcategory: "Vegetables" },
{ name: "Beef", category: "Food", subcategory: "Meat" }
];
const sortDesc: SortDescriptor[] = [{ field: "name", dir: "asc" }];
const result = orderBy(data, sortDesc);
Parameters
data T[]
The data to be sorted.
descriptors SortDescriptor[]
The descriptors by which the data will be sorted.
Returns
T[] - The sorted data.