Reputation: 109
Currently, I hide grouped columns using the k-group-indicator
element field attributes.
$("div.k-group-indicator").each(function (i, v) {
grid.hideColumn($(v).data("field"));
});
I need to then make them visible again when they are ungrouped. I cannot use the same method to do this though as I also allow the user to hide and show columns, also saving their configuration in localStorage and using it to keep the grid the same when they come back to the page.
I guess my question should be, is there an event I can use; something like OnUngroup() to capture when the grid is ungrouped and use the field name to make the column visible again?
Upvotes: 1
Views: 366
Reputation: 646
You can subscribe group event and check groups length:
group: function(e) {
if (e.groups.length == 0) {
alert('ungrouped!');
}
}
To make column visible again use function:
grid.showColumn();
EDIT:
e.groups collection contains info about columns which are actually in grouping. Using this information you can save your grouping ids in localStorage or global variable or somewhere and compare every time group event is fired.
Upvotes: 1