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

Saving/Restore group collapse state

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Loy Chan
Top achievements
Rank 1
Loy Chan asked on 31 Aug 2012, 04:05 AM
With the GridSettingsPersister class, I can save the group by expression and it works great.

In addition, I have a situation where the user wants to save the collapse state of some of the groups. Is this possible?

For example, the user will:

1. Group the list by 'project status'
2. Collapse specific groups (i.e. Pending, Cancelled)
3. Go into the details screen (i.e. another page so I store the gird settings here)
4. Go back to the list (where I need to restore the grid settings)

At step 4, all the specific groups that have been collapse are now back to their un-collapsed state.

Thoughts?

Thanks,

Loy.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 04 Sep 2012, 08:02 AM
Hello,

 You can access the GridGroupHeaderItems of the grid and save their expanded / collapsed state:

var groupHeaderItems = RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader).Cast<GridGroupHeaderItem>();
        foreach (var groupItem in groupHeaderItems)
        {
            var expanded = groupItem.Expanded;
        }

All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Loy Chan
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or