Collapse all records

Hello,

We use GridGroupingControl.
In toolstrip we have a possibility to expand and collapse all records. [grid.Table.ExpandAllRecords(); and grid.Table.CollapseAllRecords();]

If the user clicked on the Collapse All and tries to expand one node, no records will be shown in child table just header.

How can I fix this problem?

Thanks
Best Regards

6 Replies

JJ Jisha Joy Syncfusion Team February 9, 2010 06:07 AM UTC

Hi Plotnikova,

The collapseall code is collapsing the groups, and if you want them expanded again as you click the parent record's expand button, then you will have to explicitly expand them at that point. This was done by adding a RecordExpanded event handler and doing it there.

See the code:

bool ignoreExpand;
void gridGroupingControl1_RecordExpanded(object sender, RecordEventArgs e)
{
if (ignoreExpand)
return;
ignoreExpand = true;
if (e.Record.NestedTables.Count > 0)
{
GridNestedTable nt = e.Record.NestedTables[0] as GridNestedTable;
nt.IsExpanded = true;
}
ignoreExpand = false;

}

Please let me know if this helps.

Regards,
Jisha


PL Plotnikova February 9, 2010 08:17 AM UTC

Hi Jisha,

thank you so much. It helps.

What can I do if by expanding all records I don't want to show the nested records, if the count of nested records is 0.

Best Regards
Svetlana


JJ Jisha Joy Syncfusion Team February 9, 2010 08:39 AM UTC

Hi,

Please see the following KB article that shows how to hide the childtable that doesnot have any records to show up in GridGroupingControl.

http://www.syncfusion.com/support/kb/721/How-to-hide-the-ChildTable-that-doesn

Sample can be accessed from the following link:

http://help.syncfusion.com/samples/kb/grid.windows/GGCHideEmptyChildTable/main.htm


Regards,
Jisha


PL Plotnikova February 9, 2010 08:48 AM UTC

Hi,

the problem is, when I override a Factory, all others grid in project where sorce has 0 items will not be displayed.


PL Plotnikova February 9, 2010 10:06 AM UTC

I have added the extra condition [this.Engine.TableDescriptor.Relations.Count>0 ] in this new Factory for functions of overriden class GridChildTable.
So it means if the other grid, that does not have children, will be displayed.

I hope that this solution will work reliable.

Best Regards
Svetlana


JJ Jisha Joy Syncfusion Team February 9, 2010 10:51 AM UTC

Hi Svetlana,

Thank You for your update.

Loader.
Up arrow icon