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
close icon

GGC: FlattenHierarchy Hides Expand/Collapse Buttons For ChildRows.

Hi,

I've got a GGC bound to a list of parent objects: List.
Each Parent exposes a property of type List.
Each Child exposes a property of type List

As you would guess I want a grid that shows parents which expand to show children, which expand to show grandchildren.

I'm using RelationKind.UniformChildList:

GridRelationDescriptor children = new GridRelationDescriptor(relationName);
children.RelationKind = RelationKind.UniformChildList;
children.MappingName = propertyName;
parentTable.Relations.Add(children);

This works great, and the relationships map fine.

The real problem is that I want to have two modes for my grid.

1: Where each "hierarchy level" has its own sets of columns and is indented. (This mode works fine)
2: Where every row of every level is shown with the exact same set of columns, such that all data from any level lines up perfect.

#2 can be accomplished by setting some properties like so:

childTable.TableOptions.ShowTableIndent = false;
childTable.TableOptions.ShowRowHeader = false;
childTable.TableOptions.ShowTableIndentAsCoveredRange = false;

Also, you need to catch column moving events and column resizing events and make sure the col setup remains consistent across all relationTableDescriptors.

Fine.

Here's The Bug:

In "Flat Mode" the Expand/Collapse Button at the beginning of the row is missing for all but parent rows!!!

I think the problem is that some portion of the grid painting is drawing a big white box over it.


I've attached a screenshot comparing the two versions, filled with the same rows of data. You'll notice that on the right side, though expanded (through a call to ggc.ExpandAll() or something) the button is missing for all "Child" rows (Marked with a "C")
Any suggestions on how to fix this behavior?

Thanks,
Eric


SyncfusionGGCPlusIconMissin.zip

1 Reply

AD Administrator Syncfusion Team January 31, 2007 07:24 PM UTC

Hi Eric,

The reason is for disappearing the group caption plus minus cell is that you are setting the ShowTableIndent property to false. The ShowTableIndent property controls the width of the group caption plus minus cell, so you cannot set that to false and still get the +- button. But one way you can do this by handling the QueryCellStyleInfo event and set e.Style.CellType to "PushButton" for NestedTableIndentCell. If you want to implement the group caption plus minus cell like functionality, you need to handle the TableControlCellButtonClick event for expand/collaspe the childrecord. Here is a code snippet.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if( e.TableCellIdentity.TableCellType == GridTableCellType.NestedTableIndentCell)
{
GridTable table = e.TableCellIdentity.Table;
if( table.TableDescriptor.Name == "ParentTable" )
{
e.Style.CellType = "PushButton";
e.Style.Description = "+";
e.Style.Enabled = true;
}
}
}

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon