when i use ExpandAll and CollapseAll on key press event for e.g on ESC key press i use CollapseALL()
then it simply Collapses the roes depending on the Active row, second time i press ESC key i dosent Collapse the nest grouping in my Grid.
e.g.
Grouping on Client Code if i have 2 clients when i press ESC then it picks up the Active row and Collapses it but when i press ESC it dosent Collapse.
Can you post the code you are using? My guess is that you are calling CollapseAll on a row (such as the ActiveRow) instead of calling the method on the grid.
this is the code i have written to expandall and collapseall.
but i want to expand the grouping one by one means the last group then the second last and so on.
private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e) { UltraGridRow row = this.ultraGrid1.ActiveRow; //if (e.KeyChar == (char)27) if (e.KeyChar == (char)Keys.Escape) { // Call CollapseAll to collapse the row and it's descendant rows recursively. row.CollapseAll(); } else if (e.KeyChar == (char)Keys.Enter) { // Call ExpandAll to expand the row and it's descendant rows recursively. row.ExpandAll(); } }
So I was right, you are calling CollapseAll on the ActiveRow. This will collapse the ActiveRow in the grid and all if it's descendants.
If you want to collapse all rows in the entire grid, you need to use CollapseAll on the root-level rows collection:
this.ultraGrid1.Rows.CollapseAll(true);
mcsmahesh said:but i want to expand the grouping one by one means the last group then the second last and so on.
I don't understand what this means. What do you mean by "grouping"?
Hi Mike
I have a grouping like
Branch -->
Client -->
Client Details now in my grid i have two clients on one Branch1 suppose c1 and c2
when i use collapseAll() it should Collapse the Second client C2 then when i press ESC again it should Collapse the Fist Client C1.
So you are talking about the data hierarchy? You want only the lowest level of expanded rows to collapse?
There's no automatic way to do that, You would have to walk down the chain of child rows and find the rows you want to collapse and just collapse those rows.