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

Master Detail

Hello,

by my understanding Master-Detail relation has access to all records in both tables Master and Child.

I would like to do it little different. Is it possible to show aditional detail table in main table in this way:
- I click record 
- only for specific record querry is executed and detail child table is shown



3 Replies

AK Adhikesevan Kothandaraman Syncfusion Team May 30, 2016 12:39 PM UTC

Hi Danilo, 

Thanks for using Syncfusion products. 

We have analyzed your reported scenario. We are little unclear with your requirement. We need the following details for better understanding, 

1.       Can you please let me know whether you want to display the child table of the parent record with the expand state? 
         
2.       Can you please let me know whether the child table of the parent record need to be shown in the same grid or need to show the child table items in the separate Grid? 

Regards, 
Adhi 



DA DaniloS May 30, 2016 01:21 PM UTC

Hello, 

thanks for reply. Answers are bellow:

1.       Can you please let me know whether you want to display the child table of the parent record with the expand state? 
Answer: Yes         

2.       Can you please let me know whether the child table of the parent record need to be shown in the same grid or need to show the child table items in the separate Grid? 
Answer: In separate grid is no problem for me. I would like to havit in same grid, like on picture bellow maybe:


Regards!


AK Adhikesevan Kothandaraman Syncfusion Team May 31, 2016 10:41 AM UTC

Hi Danilo,  
 
Thanks for your update. 
 
If you want to expand the record to show the child table details on clicking the record, you can use the TableControlCellClick event for this. In this event you can check the condition for expand only for the particular records. Please refer to the following code snippet, 
 
Code Snippet: 
this.hierarchyGrid.TableControlCellClick += new GridTableControlCellClickEventHandler(hierarchyGrid_TableControlCellClick); 
 
private void hierarchyGrid_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) 
{ 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    if (style.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) 
    { 
        Record CurrentRecord = style.TableCellIdentity.DisplayElement.GetRecord(); 
        //Add the condition here for expanding only the particular record 
        if (CurrentRecord.HasNestedTables && CurrentRecord.GetValue("ParentName").ToString() == "parentName3") 
        { 
            //Expand the child record to show the child table  
            CurrentRecord.SetExpanded(true, true, true); 
        } 
    } 
} 
 
Sample: 
 
Regards, 
Adhi 
 


Loader.
Live Chat Icon For mobile
Up arrow icon