New to KendoReactStart a free 30-day trial

groupBy<T>
Premium

Groups the provided data according to the specified descriptors.

ts

import { groupBy } 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 result = groupBy(data, [{ field: "subcategory" }]);

Parameters

data

T[]

The data that will be grouped.
descriptors

GroupDescriptor[]

The descriptors.
transformers

Reducer

For internal use.
originalData

T[]

For internal use.

Returns

GroupResult[] | T[]

- The grouped data.
Not finding the help you need?
Contact Support