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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Retrieving a group''s records in GroupedColumns.Changed event

Thread ID:

Created:

Updated:

Platform:

Replies:

94820 Jun 3,2010 03:07 PM UTC Jun 8,2010 05:45 AM UTC Windows Forms 1
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On June 3, 2010 03:07 PM UTC

Hi,

I am using GridGroupingControl v6.303.0.6.

Whenever the user adds or removes a group, I need to retrieve the groups and their Records.

I have a handler attached to the GridGroupingControl.TableDescriptor.GroupedColumns.Changed event. In the handler, I get the groups/Records from GridGroupingControl.Table.TopLevelGroup.Groups. I then recursively iterate the Groups (and their sub-groups, etc..), and process their Records.

Unfortunately, during the GroupedColumns.Changed event the TopLevelGroup.Groups collection has not been updated to include the user's changes yet.

Is there anyway I can get the "up to date" groups/records while handling a GridGroupingControl.TableDescriptor.GroupedColumns.Changed event? Or is there another event I could use?

Currently, as a workaround, I do Thread.Sleep(100) in a background thread, and then invoke back into the UI thread. By then the TopLevelGroup collection is up to date. But this hack makes my stomach hurt :)

Jisha Joy [Syncfusion]
Replied On June 8, 2010 05:45 AM UTC

Hi Richard,

Thank you for using Syncfusion products.

You could check the e.Action and iterate though the groups to get the uptodate groups. See the code to iterate though the toplevelgroups.


void GroupedColumns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if(e.Action== Syncfusion.Collections.ListPropertyChangedType.Insert || e.Action == Syncfusion.Collections.ListPropertyChangedType.Remove)
{
this.gridGroupingControl1.Table.ExpandAllGroups();
Group grp = this.gridGroupingControl1.Table.TopLevelGroup;
DetailsSection ds = grp.Details;
//group.Records
if (ds is GridRecordsDetails)
{
GridRecordsDetails grd = ds as GridRecordsDetails;
foreach (Record r2 in grd.Records)
{
Console.WriteLine("* " + r2.ToString());
}
}
else
//group.Groups
if (ds is GridGroupsDetails)
{
GridGroupsDetails ggd = ds as GridGroupsDetails;
foreach (Group g in ggd.Groups)
{
Console.WriteLine("+ " + g.ToString());
}
}
}
}


Regards,
Jisha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;