We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Expand/Collapse GGC

Hi,

Iam using Hierarchical Grid grouping control with the datasource as dataset and my dataset contains three related tables. Iam not using any grouped columns. I want to expand, collapse GGC based on the table level. I want add three buttons called "Parent", "Child", "GrandChild". If i click "Parent" button i want to display entries in parent table(first table entries). If i click "Child" button, i want to display parent, child table entries. If i click "GrandChild" button i want to expand all entries of all the tables.

GridGroupingControl.Table.CollapseAllRecords();
GridGroupingControl.Table.CollapseAllGroups();
GridGroupingControl.Table.ExpandAllGroups();
GridGroupingControl.Table.ExpandAllRecords();

Above methods solve my requirement when i click "Parent" and "GrandChild" button, but how do i expand first level and second level table entries only( hiding third level table entries).

Thanks,
-Ravi.

3 Replies

JS Jeba S Syncfusion Team October 29, 2007 06:06 AM UTC

Hi Ravi,

Thank you for posting query to us.

You can loop through the records of the parent table and make the ChildTable expanded. Then loop through the records of the ChildTable and make the GrandChildTable collpased.

Please refer this code snippets:

this.gridGroupingControl1.Table.ExpandAllRecords();
foreach (Record r in this.gridGroupingControl1.Table.Records)
{
if (r != null)
{
r.NestedTables["ChildTable"].IsExpanded = true;
foreach (Record rec in r.NestedTables["ChildTable"].Records)
{
if (rec != null)
{
rec.NestedTables["GrandChildTable"].IsExpanded = false;
}
}
}
}


Please refer the sample which implements the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F69443/main.htm

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.


RA Ravi October 29, 2007 01:30 PM UTC

Hi Jeba,

Thanks for your reply, Your sample does not work when i add following code in Form load event.

this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false;
this.gridGroupingControl1.NestedTableGroupOptions.ShowCaptionPlusMinus = false;
this.gridGroupingControl1.NestedTableGroupOptions.ShowCaption = false;
this.gridGroupingControl1.ChildGroupOptions.ShowCaptionPlusMinus = false;

I need above code to hide caption titles. Please help me to fix the problem.

Thanks,
-Ravi.


JS Jeba S Syncfusion Team November 1, 2007 06:14 AM UTC

Hi Ravi,

PlusMinus button in the caption row maintains the Expand/Collpase State of the child Table. If you hide the PlusMinus button either through property ShowCaptionPlusMinus or ShowCaption then the IsExpanded has no effect on the child tables.


this.gridGroupingControl1.NestedTableGroupOptions.ShowCaptionPlusMinus = false;
this.gridGroupingControl1NestedTableGroupOptions.ShowCaption = false;


If you hide the caption row then all the tables are in expanded state. This is the default behaviour. We cannot change this default behaviour.

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.



Loader.
Live Chat Icon For mobile
Up arrow icon