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

[Solved] Collapsing to lowest level group

6 Answers 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Big_G
Top achievements
Rank 1
Big_G asked on 16 Sep 2010, 09:31 PM
I would like to create functionality to collapse my GridView to the lowest level group. So for example, I'm grouping by column A, then B, then C. When I click my button all the grouped entries under Column C will be collapsed but I can still see the grouped values for column A, B, and C.

I see functionality to CollapseGroup but it only accepts IGroup objects whereas my custom, programmatic grouping is done with GroupDescriptors.

How do I achieve this?

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 22 Sep 2010, 12:23 PM
Hi Big_G,

I would need more details about your requirements and setting so that I can provide you with an appropriate approach and a sample project if needed. What is your exact scenario - where do you want to click to collapse the groups and which groups you require to be collapsed - all of them or just all at a certain level?
 

Best wishes,
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
0
Big_G
Top achievements
Rank 1
answered on 22 Sep 2010, 04:39 PM
Hi Maya,

I created a button that should collapse the lowest level grouping. So on my group panel, it shows Column A -> Column B -> Column C for example. When I click my button, I need to see the lowest level collapsed while still seeing each grouped header.

For example:

Column A1
   Column B1
      Column C1
      (...data...)
      Column C2
      (...data...)
      Column C3
      (...data...)
   Column B2
Column A2
   Column B3
      Column C4
      (...data...)

In the example above, if I call myGrid.CollapseAllGroups(), I will get:

Column A1
Column A2

I need to have it so when I click my button it just collapses all the data:

Column A1
   Column B1
      Column C1
      Column C2
      Column C3
   Column B2
Column A2
   Column B3
      Column C4


If I do myGrid.CollapseAllGroups(), it will collapse everything and leave only the distinct values for Column A showing. I believe if I use myGrid.CollapseGroup(..), it will collapse column C so it will show the group headers for Column A, B, and C (not just Column A) as above.

Does that make sense?

The problem I have is the method CollapseGroup(...) accepts an object called IGroup. I am using GroupDescriptors to group my grid programatically. I can't pass this in so I'm unable to get the CollapseGroup functionality.

0
Maya
Telerik team
answered on 27 Sep 2010, 05:54 PM
Hello Big_G,

You may try to handle the Click event of that particular button as follows:

rivate void Button2_Click(object sender, RoutedEventArgs e)
{
    var groupRows = this.playersGrid.ChildrenOfType<GridViewGroupRow>();
    foreach(GridViewGroupRow groupRow in groupRows)
    {
        if (groupRow.Group.HasSubgroups == false)
        {
            groupRow.IsExpanded = false;
        }              
    }
}

 

Best wishes,
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
0
Big_G
Top achievements
Rank 1
answered on 04 Oct 2010, 04:11 PM
Hi,

I tried this solution and it seems to me like it should work but it isn't fully working. It only collapses some of the lowest level group and not all. Some are still expanded. I thought maybe because the data hasnt been loaded yet completely but I tried scrolling all the way down my grid and clicking my 'Collapse All' button but it still behaves as it did and only collapses some of my lowest level groups (HasSubgroups = false).

Is there anything we're missing or should try?
0
Joachim
Top achievements
Rank 1
answered on 05 Oct 2010, 10:56 AM
Hello Big_G,

I have the same problem.
Is it because virtualization is on ?
0
Maya
Telerik team
answered on 07 Oct 2010, 03:20 PM
Hi JOACHIM,

Unfortunately, I am not capable of reproducing the issue you specified. Please, send us a sample project (via support ticket) that demonstrates the problem. Thus we will be able to debug it locally and provide you with a solution.
 

Greetings,
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
Big_G
Top achievements
Rank 1
Answers by
Maya
Telerik team
Big_G
Top achievements
Rank 1
Joachim
Top achievements
Rank 1
Share this question
or