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

Collapsing Child Tables by default

How can I Set the default for my ChildTableGroups to be Collapsed? I have a Parent Table with multiple Parent-Child relations set on - the Grid shows a Parent Row with a "Plus" sign. When I click on the "Plus" sign all my Child Tables are already Expanded. How can I change this that my Child Tables are by default Collapsed - I only want to see the Name and description. I tried collapsing the childTables on the RecordExpanding event but this causes the Grid to Close other expanded Rows - I must be able to view Multiple Expanded Parent rows at the same time. At the same time when I expand the child table for a given record only the Child Table for that record must expand - currently when I collapse my child tables and I expand a childtable for a given row All my childTables(on that relationship) are expanded and not only the childTable for my selected record.

3 Replies

AD Administrator Syncfusion Team March 24, 2005 09:38 AM UTC

I assume you are referring to a GridGroupingControl and not a GridDataBoundGrid, correct? Does calling this.gridGroupingControl1.Table.CollapseAllRecords(); this.gridGroupingControl1.Table.CollapseAllGroups(); after setting the datasource do what you need?

TD Theo Danzfuss March 30, 2005 07:21 AM UTC

>I assume you are referring to a GridGroupingControl and not a GridDataBoundGrid, correct? TD: YES. > >Does calling > >this.gridGroupingControl1.Table.CollapseAllRecords(); >this.gridGroupingControl1.Table.CollapseAllGroups(); > >after setting the datasource do what you need? TD: Not really. For Example: I have Four "Related Grids" to my master Table. When Calling The CollapseAllGroups method all the groups are nicely collapsed, and I only see the master detail with a nice little Plus sign.When I expand this row it also shows only the names of the related tables - This is what I want BUT What I do now is I go to a row and I expand one of the Child Grids - This works fine. BUT when I go to another row in my master table and I expand it(to reveal the Related Table) The ChildTable that I expanded in the previous row is already expanded - I don''t want this behaviour. I want all the childTables to be collapsed by default. To understand Why I want this Ill describe what Im doing: Foreach one of my Tables that I view in the Grid I have a collection of "PropertyDescriptors"; they define how each one of my fields must look in the DataGrid. One of these properties is a "List" property - This means that I must show a childGrid under my master Table. Because one table can have Many of these "List" properties I can''t Select all the Data required for all the Lists when doing my initial DataBinding. What I do is during my initial DataBinding process I only select an Empty TableStructure foreach one of my "ChildTables" (list properties) and I link it to my master table using a "parentChildRelationDescriptor". Now I add an eventHandler to the childTable''s "table_GroupExpanding" event that retrieves the Data for that childTable when it is expanded. I take this further by Only selecting the data of the ChildTable for the Row that was expanded in the master Table. Now you can see my problem. When I expand a Row in my Master Table and I Select my first ChildTable the Data of muy ChildTable is retrieved - but ONLY for row 1 of my master Table. If I now move to the next row in my master table And I expand it - The ChildTable that I expanded for Row one is Also expanded for row 2, But there is no Data in it. I now have to first Collapse my childTable and then Expand it again to see the data for childTable of Row 2. Does it make any sense? Ive tried to collapse my chiltTables when expanding a masterRow, and this works, but the problem is that I can''t View 2 expanded Master Rows at one time (part of the requirement). Thanx TD

AD Administrator Syncfusion Team March 30, 2005 04:40 PM UTC

I tried to see this problem using with this sample. http://www.syncfusion.com/Support/user/uploads/GGC_Sample_4a003520.zip With it, I can open a parent row and expand a child, and then open a second parent row and not see any expmneded children. Do you see the problem with this sample?

Live Chat Icon For mobile
Up arrow icon