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

[Solved] Expand/Collapse Grouping issues

4 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 08 Sep 2009, 10:48 PM
I am having issues with the expanded state of  some of the groups in my grid, I currently have groups nested to 3 levels in my example. I have set GroupsDefaultExpanded to false both in the aspx and in the code behind. This seems to work fine for the first level, but upon expanding this level, all sub groups are expanded. I have attempted to collapse sub groups as groups are expanding client side, but am having issues with this method as well. Does anyone know how to either:

ensure all levels of grouping are contracted when a higher level group (containing group) is expanded. I would prefer to do this client side as the group is expanding, but if something can be done server side as the groups are being created that may work as well...


Thanks
Lawrence Pierce

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Sep 2009, 07:37 AM
Hello Lawrence,

An alternative suggestion would be to set GroupsLoadMode to server and enable Ajax to simulate the required behavior. You can AJAX-enable the Grid via RadAjaxManager for instance, inoreder to avoid a full page postback to the server.

Thanks
-Shinu.
0
Lawrence
Top achievements
Rank 1
answered on 10 Sep 2009, 08:02 PM
Is this the only option? I already have other client side functionality that would be broken If I must do this...

Thanks
Lawrence
0
Suresh K
Top achievements
Rank 1
answered on 11 Sep 2009, 07:27 AM
Hi.,

Can u Try This...

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
         if (e.CommandName == RadGrid.ExpandCollapseCommandName) {
         GridItem item = default(GridItem);
         foreach (var item in e.Item.OwnerTableView.Items) {
            
             if (item.Expanded && (!object.ReferenceEquals(item, e.Item))) {
                    
                 item.Expanded = false;
             }
         }
         
     }
    }
0
Kelly Ford
Top achievements
Rank 1
answered on 29 Sep 2009, 08:02 PM
This appears to only work if GroupsLoadMode is set to Server and therefore would require a postback for every group item expanded.  Too slow.
Tags
Grid
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Lawrence
Top achievements
Rank 1
Suresh K
Top achievements
Rank 1
Kelly Ford
Top achievements
Rank 1
Share this question
or