New to Kendo UI for VueStart a free 30-day trial

groupBy

Function

Definition

Package:@progress/kendo-data-query

Syntax:

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" }]);

Groups the provided data according to the specified descriptors.

Parameters:dataT[]

The data that will be grouped.

descriptorsGroupDescriptor[]

One or more GroupDescriptor objects that define the fields and sort direction to group by.

Returns:

T[] | GroupResult[]

A hierarchical array of GroupResult objects, or the original flat array when no descriptors are provided.

Example:
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" }]);
In this article
Definition
Not finding the help you need?
Contact Support