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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hierarchical data on-demand

Thread ID:

Created:

Updated:

Platform:

Replies:

110429 Aug 2,2013 06:18 PM UTC Aug 7,2013 04:09 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Gary Yochum
Asked On August 2, 2013 06:18 PM UTC

We are currently retrieving hierarchical data in the form of strongly-typed collections.  For example, the top level of data on the grid is of type BindingList<Operation>, the child level is BindingList<OperationPart>, and the grandchild level is BindingList<OperationPartJob>.

Whereas the sample on SyncFusion's site retrieves all data (parent, child, g-child), we are looking to retrieve child level data only when a parent record is expanded, then similar behavior for g-child data when a child row is expanded.

We can expand a parent row, retrieve our unique identifier, then retrieve child records based on the identifier which then displayed on our grid - lovely.  

However, when we attempt to expand a child record we are unable to retrieve the child's unique identifier in order to make a database call to retrieve g-child data.

The method SetUpDataHierarchy() is currently called when the page is loaded AND after data is retrieved for child/g-child level data upon OnRecordExpanded events.  As you will see, nothing dissimilar to what is in the hierarchical sample provided by SF apart from using strongly-typed collections over DataTables:

private void SetUpDataHierarchy(IList<Operation> operations, IList<OperationPart> parts, IList<OperationPartJob> jobs)
        {
            //create child relationship
            var operationToPartRelationship = new GridRelationDescriptor
            {
                ChildTableName = "OperationParts",
                RelationKind = RelationKind.RelatedMasterDetails                
            };

            //add relationship keys
            operationToPartRelationship.RelationKeys.Add("OperationNumber", "OperationNumber");
            operationToPartRelationship.ChildTableDescriptor.AllowEdit = false;

            //add relationship to top level grid table descriptor
            PartsGrid.TableDescriptor.Relations.Add(operationToPartRelationship);

            //create g-child relationship
            var partToJobRelationship = new GridRelationDescriptor
            {
                ChildTableName = "OperationPartJobs",
                RelationKind = RelationKind.RelatedMasterDetails
            };

            //add g-child relationship keys
            partToJobRelationship.RelationKeys.Add("PartNumberKey", "PartNumberKey");
            operationToPartRelationship.ChildTableDescriptor.Relations.Add(partToJobRelationship);

            partToJobRelationship.ChildTableDescriptor.AllowEdit = false;

            PartsGrid.Engine.SourceListSet.Add("Operations", operations);
            PartsGrid.Engine.SourceListSet.Add("OperationParts", parts);
            PartsGrid.Engine.SourceListSet.Add("OperationPartJobs", jobs);

            //PartsGrid.DataSource = operations;

            PartsGrid.TableDescriptor.Name = "Operations";
            PartsGrid.TableDescriptor.Columns[0].Width = 80;
            PartsGrid.TableDescriptor.Columns[0].Appearance.AnyHeaderCell.WrapText = false;
        }
This is what we have for the OnRecordExpanded event handler - essentially we make sure the user is expanding the record, then we check to see the GroupLevel value (level for nested group).  If 0, we know to get the child data.  If 1, we would then get the g-child data and here lies our issue at the moment.  Even when we click to expand a child record, the GroupLevel value in the RecordExpanded event handler is still 0 instead of 1.  Also, e.Record is the root level record we first expanded (parent).
 
protected void PartsGrid_RecordExpanded(object sender, RecordEventArgs e)    
        {
            if (e.Record.IsExpanded)
            {
                string key = string.Empty;

//we are expanding a parent level record
                if (e.Record.GroupLevel == 0)
                {
                    key = e.Record.GetValue("OperationNumber").ToString();
                    LoadChildData(key);
                }
//we are expanding a child level record
                else if (e.Record.GroupLevel == 1)
                {
                    key = e.Record.GetValue("PartNumber").ToString();
LoadGrandChildData(key);
                }                
            }
}

So in summary, is there something in the we are setting up the parent-child-grandchild relationships we are doing wrong AND/OR is there another way to retrieve g-child data in the RecordExpanded event handler?

We are stumped at the moment and would very much appreciate some help - thanks!

Eswari S [Syncfusion]
Replied On August 7, 2013 04:09 AM UTC

Hi Gary,

 

Thank you for using Syncfusion products.

 

We have updated response for this query in the incident #111462.

 

Let us know if you have any queries.

 

Regards,

Eswari S

 


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.

Warning Icon 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.Close Icon

;