I have a grid that could be grouped by one of the columns or ungrouped. GroupLoadMode = "Client".
What is the easiest way to get the grouping state (grouped or ungrouped) of the grid on the client side.
Thanks,
Olga
Rumen
Telerik team
commented on 07 Dec 2023, 09:05 AM
Hi Olga,
You can check whether the grid is grouped or ungrouped on the client-side using one of the following approaches:
var gridElement = $find("<%=RadGrid1.ClientID%>").get_element();
var groupHeaders = gridElement.querySelectorAll(".rgGroupHeader");
var isGrouped = groupHeaders.length;
if (isGrouped >0) {
console.log("The grid is grouped.");
} else {
console.log("The grid is not grouped.");
}
or through the
$find("<%=RadGrid1.ClientID%>")._groupPanel._items.length setting. If it is 0 then the grid is ungrouped, if it is 1 or more it is grouped.
Hi Olga,
You can check whether the grid is grouped or ungrouped on the client-side using one of the following approaches:
var gridElement = $find("<%=RadGrid1.ClientID%>").get_element(); var groupHeaders = gridElement.querySelectorAll(".rgGroupHeader"); var isGrouped = groupHeaders.length; if (isGrouped >0) { console.log("The grid is grouped."); } else { console.log("The grid is not grouped."); }
or through the
$find("<%=RadGrid1.ClientID%>")._groupPanel._items.length setting. If it is 0 then the grid is ungrouped, if it is 1 or more it is grouped.