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

OnGroupExpanding extract group information

1 Answer 80 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Matt asked on 27 Oct 2010, 10:24 PM

I have a requirement for a project that I'm having some difficulty getting to work.  I've looked at the following post,, but it only takes me so far.  For my page, I have a grid that is configured for client-side grouping.  I have a requirement that the expanded groups are persisted on grid rebind.  There is a control on the page that allows the user to select from a list of items that translate to the groups in the grid.  So, the user selects 3 items in the list and there are 3 groups of those selected items in the grid, the user selects 5 items from the list and there are 5 groups in the grid, etc.  In other words the number of groups is variable based on user selection. 
I've set up a web service to handle the persisting of the group information via ajax callback from the page, and that all works fine.  The problem I'm having is that there isn't any way to get the selected group information in the OnGroupExpanded or OnGroupCollapsed events.  It appears that the sender is the grid itself and the event args are empty?  I currently have the following code, based on the link above:


<telerik:RadGrid ...>
    <ClientSettings EnableRowHoverStyle="false">
        <ClientEvents OnGroupExpanded="groupExpanded" />


groupExpanded(sender, e) {
var grid = $find(sender.get_id());
var expandedGroupItems = grid._expandedGroupItems;
var lastItemId = expandedGroupItems[expandedGroupItems.length - 1];
alert("Owner TableView: " + lastItemId.split('!')[0]);
alert("Table Row Index : " + lastItemId.split('!')[1]);

In the example, it shows getting the row index by parsing the item ID and then this ID can be used server-side to set the row expansion.  However with variable groups, that ID is also variable (I've tested as such, the IDs change as groups are added or removed).  Is there really no way to get at the group item that was expanded or collapsed directly?  What I'd like, is to use our own internal unique id for the group, but it doesn't look like any group information is exposed at all in these events.

Also, I'd like to say that the documentation for OnGroupsExpanded and OnGroupsCollapsed is incorrect.  It states that the sender is a GridDataItem, when in fact it is the grid itself.  It is a bit confusing.

Any and all help would be greatly appreciated.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 02 Nov 2010, 10:14 AM
Hi Matt,

Unfortunately the RadGrid does not support the desired functionality, concerning getting the selected group information in the OnGroupExpanded or OnGroupCollapsed events. I confirm that the sender into this events is the RadGrid object and the event arguments are empty.
The event arguments are empty because the group header item is not a GridDataItem and it does not have item index or any id by which it could be recognized.
To persists the expand/collapse state on Rebind() you could try using the server side persisting which is showed on the following code library:
Additionally we will make sure to update our documentation to prevent further confusion.

Best wishes,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question