Three-Level Hierarchy

Hi guys,

we use the gridgroupingcontrol for display data in 3-level-hierarchy. We need to know how to expand or collapse child-records depends on data. I mean some child should expand and some should be collapsed when loading data.

Further we need to know how to refresh child - tables, when data is added or deleted, without refreshing all data.

we are grateful for your support.

regards
p.p.Tuong Trinh


1 Reply

RR Ranjithkumar R G Syncfusion Team May 30, 2012 06:13 AM UTC

Hi Tuong,

 

Thanks for using Syncfusion products.

 

Query#1:”Expand/Collapse based on condition”

 

We suggest you to expand all records in the Hierarchy Grid in the QueryCellStyleInfo event and then collapse the records based on some condition by handling RecordExpanded event. Please refer to the code snippet below to achieve this.

 

[CS]

 

void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)

    {

        if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell)

        {

            Record r = e.TableCellIdentity.DisplayElement.ParentRecord as Record;

 

            r.NestedTables[0].ParentTable.ExpandAllRecords();//Expanding all records of the Parent table

          

        }

    }

 

    void GridGroupingControl1_RecordExpanded(object sender, RecordEventArgs e)

    {

        if (e.Record.GetValue("ParentName")!=null && e.Record.GetValue("ParentName").ToString() == "parentName0")

        {

 

            e.Record.IsExpanded = false// Collapsing the record of Parent Table with the value 'parentName0'

        }

    }

 

 

Query#2:” Refreshing only child table”

 

We would like to let you know that refreshing child grid only when it’s data is added/edited cannot be achieved in our current implementation.  Adding/Modifying data in Child Table will refresh the whole grid.

 

Please refer to the below link to download the sample application.

 

threelvl-hierarchy-web.zip

 

Please let us know if you  have any concern.

 

Regards,

Ranjithkumar.


Loader.
Up arrow icon