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

Tree behaviour in GGC

Hi,
Can anyone tell me if it is possible to have a tree structure in the GGC with a parent-child relationship
The datasource has an ID column and a ParentID column which describes the relationships. I attach a screen shot of this using another grid product. How do I do this in syncfusion?
Thanks
Paul

TreeGrid.zip

12 Replies

HA haneefm Syncfusion Team August 28, 2007 08:23 PM UTC

Hi Paul,

Here is a minimal sample that implements TreeStructure in a GroupingGrid. Please try this and let me know if this helps.
GroupingGridTree.zip

Currently, the grouping engine has some limited support for such self-relations. Below is a miniaml sample that demonstrates a table that has records with parent references to other records in the table.
SelfRelations.zip

Best regards,
Haneef


PS Paul Sullivan August 29, 2007 08:54 AM UTC

Thanks Haneef that is what I'm looking for (Self Relations),
Just one question - how do I get the expanded rows to show without column headers? (as in my example)
Thanks
Paul


HA haneefm Syncfusion Team August 29, 2007 06:31 PM UTC

Hi Paul,

You can try this code to hide an expanded row ColumnHeader in a GroupingGrid.

this.gridGroupingControl1.NestedTableGroupOptions.ShowColumnHeaders = false;

If you want to hide an expanded CaptionRow(above the ColumnHeaderRow) then try setting the ShowCaption property to false;

this.gridGroupingControl1.NestedTableGroupOptions.ShowCaption = false;

Best regards,
Haneef


PS Paul Sullivan September 4, 2007 03:46 PM UTC

Thanks Haneef,
I have got that to work with my data now. I have some further questions:
1. The example provided seems to rely on "missing" ParentID tags in the source xml file. This really isn't practical, sure - for a demo I can manually edit my xml file but I can't do this in a production system. My ParentID node will just be empty rather than not existing. If I try this here I get every child row repeated outside of the parent node. Is there another way to configure the behaviour so that I can use such a dataset? I have attached suitably named xml samples and my xsd schema.
2. Please view the attached bmp. How do I remove the "expand node" buttons for those rows which have no children?
Thanks
Paul


SelfRel.zip


PS Paul Sullivan September 5, 2007 10:01 AM UTC

Hi Haneef, please ignore point 1. of my last message - I've figured it out - it works if the parentID is null. Please answer point 2. though.
Also, is it possible to reduce or even get rid of the indentation of the child rows so that they line up with the master column headers?
Thanks
Paul


PS Paul Sullivan September 5, 2007 10:39 AM UTC

I am also finding that in this "self relation" mode the grid draws very slowly, and moving with scrollbars is also very slow. I will not be able to use this grid in our product unless this can be sped up. Is there any way to improve this/has this been improved in more recent versions?
VersionInfo = "5.102.0.37";
Thanks
Paul


PS Paul Sullivan September 5, 2007 04:45 PM UTC

Also, I am finding that with the grid in this "mode" if I apply a RecordFilter it has no effect other than to put the filtered records at the top of the grid but still displaying all the (filtered out) records beneath them.
I'm sorry to continually use this forum, really i'd rather not, but the Syncfusion help files are frankly, no help.


PS Paul Sullivan September 6, 2007 04:23 PM UTC

Hi Guys,
I attach an amended version of your example app for self relations. I have one problem now apart from the slowness when loading a large amount of data. The problem is that, as will see when you run my example, when I hide some of the columns in my grid, they are not hidden when I expand the child rows.

SelfRelations.zip


PS Paul Sullivan September 6, 2007 04:43 PM UTC

Apologies, I've figured it out. If anyone wants to know it's possible as follows:
treeList1.TableDescriptor.Relations[0].ChildTableDescriptor.VisibleColumns
=
treeList1.TableDescriptor.VisibleColumns;

Can anone answer the above questions re: indenting of child rows and removal of the "+" button for childless rows?

Thanks for your patience
Paul


HA haneefm Syncfusion Team September 6, 2007 10:55 PM UTC

Hi Paul,

You can handle the QueryCellStyleInfo event of the grid and set the e.Style.CellType property to "Static" for childless records in a GridRecordPlusMinusCell. Below are the codes that show this task.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell)
{
Record rec = el.GetRecord();
if (rec.NestedTables.Count > 0 && rec.NestedTables[0].Records.Count == 0 )
{
e.Style.CellType = "Static";
e.Style.Borders.All = new GridBorder(GridBorderStyle.Standard );
}
}
}

Best regards,
Haneef


PS Paul Sullivan September 7, 2007 08:29 AM UTC

Thanks Haneef,
And how do I remove the the child columns' indentation so that they line up with the parent columns
Paul


HA haneefm Syncfusion Team September 24, 2007 05:31 PM UTC

Hi Paul,

To show the nested childs in grid without indenting, you need to set the TableOptions.ShowTableIndent property of the grid to false.

[c#]
grid.TableOptions.ShowTableIndent = false;

Below is a forum thread that discuss with this task.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=56982

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon