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
close icon

Expand and collapse nested table in gridGroupingControl

Hi, I am using GGC with nested tables. I want to expand/collapse nested table records on button click. What is property to do the same..? Thanks, Prathima

3 Replies

AD Administrator Syncfusion Team September 28, 2005 10:38 AM UTC

Hi Prathima You can use the following code to expand and collapse the nested table records. To Expand this.gridGroupingControl1.Table.ExpandAllRecords(); To Collapse this.gridGroupingControl1.Table.CollapseAllRecords(); To Expand a selected record this.gridGroupingControl1.Table.SelectedRecords[0].Record.IsExpanded = true; Best Regards Mouli.


PV Prathima Venkobachar September 28, 2005 11:38 AM UTC

Thanks for the reply.It works fine. I have one more problem, If my grid has only grouping and no nested table..then also on click of this button it expands all the groups. So I want to make a check if the grid has nested table then only it should expand all records.How can I do this check..? I tried with HasChildren property..it is returning true even though the grid doesn''t have any nested table. Thanks, Prathima


AD Administrator Syncfusion Team September 28, 2005 02:43 PM UTC

Hi Prathima , I think that you have grouped the main table and the main table has got nested table. The following code checks if the each record in each group has got records of nested table. If so it expands the group as well as the nested table records for each group. foreach(Group g in this.gridGroupingControl1.Table.TopLevelGroup.Groups) foreach(Record r in g.Records) if( r.NestedTables[0].ChildTable.Records.Count > 0) g.IsExpanded = true; r.IsExpanded = true; } Best Regards Mouli

Loader.
Live Chat Icon For mobile
Up arrow icon