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.

Automatic refresh of grouping in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

62630 Jun 19,2007 12:16 PM Jun 21,2007 06:13 PM Windows Forms 5
loading
Tags: GridControl
M
Asked On June 19, 2007 12:16 PM

I have a problem with the automatic refreshing of grouping of a GridGroupingControl using DataBinding and custom cell types. In the attached example I have a BindingList with persons. A person has simple properties like "firstname" and "lastname" (both strings), and an complex property "adress" (class Adress). The "adress" has an own cell type, which parses an entered adress. If I group by "adress" and change the "adress" of an entry, the grouping of the grid is not updated automatically. The refresh of the grouping by "firstname" or "lastname" works as I expect.
The class "adress" implements IComparable.

Thanks.

GGC_RefreshGrouping.zip

haneefm [Syncfusion]
Replied On June 19, 2007 02:09 PM

Hi Michael,

You can try setting the Table.TableDirty to true to refresh the grid table when group has been modified. Below are the modified code snippets from CustomCell.cs file

protected override bool OnSaveChanges()
{
m_OldValue.Parse(TextBox.Text);
this.ControlValue = m_OldValue;
bool bvalue = base.OnSaveChanges();
GridTableControl tc = this.Grid as GridTableControl;
if (tc != null)
{
tc.Table.TableDirty = true;
}
return bvalue;
}

Best regards,
Haneef

M
Replied On June 20, 2007 03:01 AM

Thanks.

Is it possible to keep the groups expanded after changing a field of a grouped column?

Michael.

haneefm [Syncfusion]
Replied On June 20, 2007 01:33 PM

Hi Michael,

You can catch the expanded group before calling the ReIntialize method and then expand these groups after calling the reintialize method. Below are the modified code snippets from CustomCell.cs file

private ArrayList groups;
protected override bool OnSaveChanges()
{
m_OldValue.Parse(TextBox.Text);
this.ControlValue = m_OldValue;
bool bvalue = base.OnSaveChanges();
GridTableControl tc = this.Grid as GridTableControl;
if (tc != null)
{
groups = new ArrayList ();
this.iterate(tc.Table.Engine.GroupingControl.Table.TopLevelGroup);

tc.Reinitialize();
for (int i = 0; i < groups.Count; i++)
(groups[i] as Group).IsExpanded = true;
}
return bvalue;
}

public void iterate(Group g)
{
if (g.IsExpanded)
groups.Add(g);
foreach (Group gr in g.Groups)
iterate(gr);
}

Best regards,
Haneef

M
Replied On June 21, 2007 09:39 AM

Hi Haneef,

Thank you, but your solution does not work. After reinitialize the GridTableControl the IsExpanded property of the groups is already true. So the following iteration does not do anything.

Thanks,
Michael.

haneefm [Syncfusion]
Replied On June 21, 2007 06:13 PM

Hi Michael,

You can expand or collapse it by setting g.IsExpanded to true or false. Here is a minimal sample that shows this task and let me know if this helps.
ModifiedGGC_RefreshGrouping.zip

See the forum thread for persisting the expanded group levels in a grid.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=29909

Best regards,
Haneef

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.

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.

;