groupBy

Returns a copy of the list grouped according to the descriptor

Parameters

descriptor Object

The grouping configuration. Accepts the same values as the group option.

Returns

kendo.data.Query Returns a new instance of kendo.data.Query containing the grouped collection

Example

<script>
    var query = new kendo.data.Query([
        { name: "Jane Doe", age: 30, department: "Sales" },
        { name: "John Doe", age: 33, department: "IT" },
        { name: "Bob Smith", age: 25, department: "Sales" },
        { name: "Alice Johnson", age: 28, department: "Marketing" }
    ]);
    
    var groupedQuery = query.groupBy({
        field: "department"
    });
    var result = groupedQuery.toArray();
    // the result can be seen in the browser console.
    console.log(result); // Will be grouped by department
</script>
In this article
groupBy
Not finding the help you need?
Contact Support