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

Expand Single Group

5 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brandon Zeider
Top achievements
Rank 1
Brandon Zeider asked on 26 Aug 2009, 07:54 PM
I have a grid with multiple group descriptors - how do I expand just one of those groups? I see the ExpandGroup method, but do not understand how to implement.

Thanks.

5 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 27 Aug 2009, 06:52 AM
Hello Brandon Zeider,

With a version prior to Q2 2009 you can expand a group by setting the IsExpanded property to true of any GroupRecord or GridViewGroupRow.

((GroupRecord)this.RadGridView1.Records[0]).IsExpanded = true

When RadGridView is grouped the Records collection will contain GroupRecords that correspond to the groups that you see on the grid itself. You can get any of the groups and set IsExpanded to true to expand it.

After Q2 2009 SP1 you could still use this approach or use the ExpandMethod that you have mentioned.

// required namespace System.Linq  
this.RadGridView1.ExpandGroup(this.RadGridView1.Items.OfType<IGroup>().ElementAt(0)); 

The ExpandGroup method expects an argument of type IGroup which is an Interface of our new data engine and will supercede the GroupRecord sometime in the future. Unofrtunately at the moment it is not straighforward to access the collection of IGroups and some Linq extension methods have to be used to get to a specific IGroup. The code above will get the first IGroup (similar to GroupRecord).

We are currently improving our API so that it will be easier to use the ExpandGroup method.

Hope this helps.

Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Anand
Top achievements
Rank 1
answered on 19 Apr 2011, 09:01 AM

Hi,

I want to do Expand Single Group .How to do that?

Thanks,
Anand
0
Vlad
Telerik team
answered on 19 Apr 2011, 09:03 AM
Hi,

 You can use ExpandGroup() method of the grid to achieve your goal. 

All the best,
Vlad
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
0
Anand
Top achievements
Rank 1
answered on 19 Apr 2011, 09:07 AM
Hi,

Is there any property like Expand Mode "Single" for the group

Thanks,
Anand
0
Maya
Telerik team
answered on 19 Apr 2011, 10:37 AM
Hello Anand,

If you want to expand a particular group, you may use the ExpandGroup() method of the grid. In case you require only a single group to be expanded at a time, you may benefit from the approach demonstrated in thisblog post. However, your implementation may be similar to:

GridViewGroupRow lastExpandedGroupRow;
        void clubsGrid_GroupRowIsExpandedChanging(object sender, Telerik.Windows.Controls.GridView.GroupRowCancelEventArgs e)
        {
            if((e.Row as GridViewGroupRow).IsExpanded == true)
            {
                if(lastExpandedGroupRow != null)
                {
                    lastExpandedGroupRow.IsExpanded = false;
                }
                lastExpandedGroupRow = e.Row as GridViewGroupRow;
            }          
        }

 

All the best,
Maya
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
Tags
GridView
Asked by
Brandon Zeider
Top achievements
Rank 1
Answers by
Milan
Telerik team
Anand
Top achievements
Rank 1
Vlad
Telerik team
Maya
Telerik team
Share this question
or