This is a migrated thread and some comments may be shown as answers.

Grid Grouping - Default a group as Collapsed

1 Answer 369 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Drew
Top achievements
Rank 1
Drew asked on 21 Jun 2012, 01:51 PM
Hey All
When using a Grid and a grouped Data Source; is there anyway to make a group be collapsed by default (rather than expanded).

DataSource parameter ...

group: [{ field: "DepartmentName" }, { field: "EmployeeName"}],

I would love it if there was something like

group: [{ field: "DepartmentName", status: "exp" }, { field: "EmployeeName", status: "col"}],


I could always collapse each on load, but that seems cumbersome 

1 Answer, 1 is accepted

Sort by
0
Drew
Top achievements
Rank 1
answered on 21 Jun 2012, 05:40 PM
Maybe there's a better way, but this worked:

                        <script type="text/javascript">

                            function CollapseAllRows() {

                                var grid = $('#grid_ClockedHours').data('kendoGrid');

                                grid.tbody.find('>tr.k-grouping-row').each(

                                    function (e) {

                                        grid.collapseRow(this);

                                    });

                            }

                        </script>

        var grid = $("#grid_ClockedHours").kendoGrid({

            dataSource: data_ClockedHours,

            dataBound: function (e) {

                CollapseAllRows();

            }});

Tags
Grid
Asked by
Drew
Top achievements
Rank 1
Answers by
Drew
Top achievements
Rank 1
Share this question
or