I am programmatically adding 2 group by rows to my grid (I would prefer to do this in the Designer but understand this is not possible?) using the following:
grid.DisplayLayout.Bands[0].SortedColumns.Add("ColOne", false, true);grid.DisplayLayout.Bands[0].SortedColumns.Add("ColTwo", false, true);
I would like to have the ColOne group expanded by default, and the ColTwo group collapsed by default.
Nothing I do to programmatically expand/collapse rows has any effect, e.g. grid.ExpandAll(), row.Expanded = true, row.ExpandAll() etc. When I inspect the Rows collection e.g. within InitializeLayout there are no UltraGroupByRows in the collection, only data rows - is this expected? I do see the group by rows on-screen at run-time.
The only thing which has any effect on expanding rows is setting
ultraGridBand1.Override.GroupByRowInitialExpansionState = Infragistics.Win.UltraWinGrid.GroupByRowInitialExpansionState.Expanded; However, that expands both groups whereas I would only like to expand the parent group.
Am I approaching this in the right way, and if so why can't I expand any rows programmatically? Any help appreciated, thanks.
Hi Mike,
This helped me to expend the grouped rows.
Regareds Peter
Sorry I don't have time to make a sample project. For now I am doing this to get going, a not too bad solution :)
if (e.Layout.Bands[0].Layout.Grid.Rows.Count ==1) { //Due to an Infragistics bug, this line stops working inside an if statement, it works if I remove the if, very strange //e.Layout.Bands[0].Override.GroupByRowInitialExpansionState = GroupByRowInitialExpansionState.Expanded; _grid.Rows.ExpandAll(true); //because above line not working, using this instead to expand all bands which is not as good }
-Steve
Hi Steve,
Well, then I am out of ideas. :)
If you can provide a small sample project, we can check it out, but we have to be able to reproduce the issue in order to see what's going on. BTW... you should probably start a new thread, so we can create a case for you.
We are using 2013 Vol2. And adding e.Layout.Grid.Update() like below doesn't work (just FYI, tried adding it after the expanded line didn't work either):
if (e.Layout.Bands[0].Layout.Grid.Rows.Count == 1)
{
e.Layout.Grid.Update();
e.Layout.Bands[0].Override.GroupByRowInitialExpansionState = GroupByRowInitialExpansionState.Expanded;
}
Thanks
Steve
What version of the grid are you using? This sounds like a bug we recently fixed internally - the fix is not yet publicly available. Try calling e.Layout.Grid.Update() right before you set the GroupByRowInitialExpansionState property and see if that helps.
If not, then see if you can reproduce the problem in a small sample project and post it here and I will be happy to take a look.