Here is what I have so far:
$(reportTableSelector).kendoGrid({
dataSource: dataSource,
sortable: false,
pageable: false,
scrollable: false,
columns: colModel
});
var grid = $(reportTableSelector).data("kendoGrid");
grid.collapseGroup(grid.tbody.find(">tr.k-grouping-row"));
$('tr[role*="row"]').hide();
If I put the last three lines of code in a click
handler function, it will effectively collapse all the grouped rows but not when calling it after initializing the grid
.
A more idiomatic way of doing it
var collapseAllGroups = function (grid) {
grid.table.find(".k-grouping-row").each(function () {
grid.collapseGroup(this);
});
}
//On the grid
dataBound: function (e) {
collapseAllGroups(this);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With