Retrieving Child Data on RowExpand Event?

Hi, I have a Parent-Child relation set on my Grouping control, the problem is that the data in my ChildTable are extremely big. I want to retrieve the related child data on the rowExpanding event of my grouping control. How would I do this? Can I set up my relationship when there''s no data in the childTables? Can you please give me a code snippet of how to do this. Thanks Theo Danzfuss

6 Replies

AD Administrator Syncfusion Team April 28, 2005 08:04 PM UTC

Hi Theo, I created a small sample that populates the child/details table only the first time the user expands a record of the parent table. You can download it here: CS.zip Stefan


TD Theo Danzfuss May 3, 2005 03:36 PM UTC

Stefan, The only change I made was to call the PopulateTable() method on the "this.gridGroupingControl1.GroupExpanded" event after calling, this.gridGroupingControl1.Table.CollapseAllRecords ( ); I now have the behaviour I want. Thanks alot! TD >Hi Theo, > >I created a small sample that populates the child/details table only the first time the user expands a record of the parent table. > >You can download it here: CS.zip > >Stefan >


AD Administrator Syncfusion Team May 3, 2005 04:07 PM UTC

Hi, I got too happy, too quickly. See my attached example. It works correctly AS-IS, Each table gets populated when the Tablename gets expanded from the parentRow. BUT when I remove the GrandParentTable Relationship, it doesn''t work correctly anymore - you''ll see that the Groups Aren''t collapsed when you expand the parent row, and you have to first Close the group and then Re-open it before it gets populated. Also once you have expanded one parent row ALL parent Rows are expanded - this is also a problem seeing that in my final app, Ill populate the ChildTable Per Record - The populateTable method wont populate all the rows, but only those applicable for the selected parent Row. Can you please help me with this. Thanks TD CS_modified_8172.zip


AD Administrator Syncfusion Team May 3, 2005 06:05 PM UTC

I think I was able to get this working by adding an e.Record.ParentChildTable.CollapseAllRecords call after the PopulateChildTable call. (I tried it using both 3.0.1.0 and 3.2.1.0.)
private void gridGroupingControl1_RecordExpanding(object sender, RecordEventArgs e)
{
	if ( childTable.Rows.Count <= 0 )
	{
		PopulateChildTable ( childTable );
		e.Record.ParentChildTable.CollapseAllRecords();
	}
}


TD Theo Danzfuss May 5, 2005 06:47 AM UTC

Hi, It works fine if you do it on the RecordExpanding event, but I need to do it on the GroupExpanding event. In my Scenario there are typically 5-10 ChildTables, and I can''t retrieve ALL childtable Data on the RecordExpanding event, I must do it on the GroupExpanding event - this allows me to know what ChildTable data to retrieve. If I do the same on the GroupExpanding event, then It closes all my open rows - you must be able to have existing rows open! TD


AD Administrator Syncfusion Team May 9, 2005 04:02 PM UTC

Hi, I got it working with this sample code by making sure the child groups are initially not expanded. This can be accomplished by handling the GroupAdded event. private void gridGroupingControl1_GroupAdded(object sender, GroupEventArgs e) { e.Group.IsExpanded = false; } Attached find sample code compilable with 3.2.1.0 CS.zip Stefan >Hi, > >It works fine if you do it on the RecordExpanding event, but I need to do it on the GroupExpanding event. >In my Scenario there are typically 5-10 ChildTables, and I can''t retrieve ALL childtable Data on the RecordExpanding event, I must do it on the GroupExpanding event - this allows me to know what ChildTable data to retrieve. >If I do the same on the GroupExpanding event, then It closes all my open rows - you must be able to have existing rows open! > >TD

Loader.
Up arrow icon