New to Kendo UI for jQuery? Start a free 30-day trial
Collapse Groups in Grid by Default
Updated over 6 months ago
Environment
| Product | Progress® Kendo UI® Grid for jQuery | 
| Product Version | Created with the 2017.3.1026 version | 
Description
How can I render Kendo UI Grid groups as collapsed by default?
Solution
- Handle the 
dataBoundevent of the Grid. - Iterate through each group by calling 
collapseGroupfor it. 
<div id="grid"></div>
<script>
    $("#grid").kendoGrid({
        columns: [
            { field: "productName" },
            { field: "category" }
        ],
        dataSource: {
            data: [
                { productName: "Tea", category: "Beverages" },
                { productName: "Coffee", category: "Beverages" },
                { productName: "Ham", category: "Food" },
                { productName: "Bread", category: "Food" },
                { productName: "Bread", category: "abc" }
            ],
            group: { field: "category" }
        },
        groupable: true,
        dataBound: function (e) {
            var grid = this;
            $(".k-grouping-row").each(function (e) {
                grid.collapseGroup(this);
            });
        }
    });
</script>