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

Automatic refresh of grouping in GGC

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

5 Replies

HA haneefm Syncfusion Team June 19, 2007 06:09 PM UTC

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 M June 20, 2007 07:01 AM UTC

Thanks.

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

Michael.


HA haneefm Syncfusion Team June 20, 2007 05:33 PM UTC

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 M June 21, 2007 01:39 PM UTC

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.


HA haneefm Syncfusion Team June 21, 2007 10:13 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon