Master-Details Relation in SfDataGrid
Hi.
I'm new to Syncfusion Tools and looking for a DataGrid to show Master-Detail relations.
I've found it in the GridDataBoundGrid component - https://help.syncfusion.com/windowsforms/databoundgrid/using-master-details-relation
That's what I need.But it looks like this control is "classic" and one should better use the SfDataGrid when starting new projects.
In SfDataGrid I could only find "nested detail grids".
So my question is: does SfDataGrid also support the way of showing Master-Detail-Relations like the GridDataBoundGrid?
Thanks
SIGN IN To post a reply.
7 Replies
JN
Jayaleshwari N
Syncfusion Team
January 28, 2019 11:12 AM UTC
Hi Alfred,
Thanks for contacting Syncfusion Support.
We have checked the reported query “Master-Details Relation in SfDataGrid” from our side. SfDataGrid provided support to show Master-Details relations as per your requirement. You can refer the following user guide documentation to use the Master-Details View in SfDataGrid.
Master Details View UG link - https://help.syncfusion.com/windowsforms/sfdatagrid/masterdetailsview
We have prepared the sample with master details view in SfDataGrid for your reference and you can download the same from the following location.
Please let us know if you would require further assistance.
Regards,
Jayaleshwari N
AK
Alfred Klein
January 28, 2019 07:50 PM UTC
Hi Jayaleshwari
thank you for your assistance.
I've tried your example which shows the following result like the screen shot - the Detail-grid is nested in the Master-grind:
But what I want do achieve is to place the Detail-grid in a separate panel beneath the Master-grid.
Like it is shown for the databoundgrid in https://help.syncfusion.com/windowsforms/databoundgrid/using-master-details-relation
Screenshot:
With this approach I will be able to design a screen with
- one master-grid in the top-panel. For example: customer
- two or more detail-grids of the customer in the bottom-panel in tabsheets.
For example: customer-orders in tab1, customer-contact-persons in tab2, customer-mailing-list in tab3, ...
Is there any way to achieve this with SfDatagrind
Thanks again
Alfred
MA
Mohanram Anbukkarasu
Syncfusion Team
January 29, 2019 02:01 PM UTC
Hi Alfred,
Thanks for your update.
SfDataGrid doesn’t have direct support to display master and details view in separate panels and tab pages as per your requirement. However we have a workaround to achieve this by using separate SfDataGrid controls for master and the details view and the TabControl to hold the child DataGrid. The DataSource for the child DataGrid can be changed when selection is changed in the parent DataGrid by using the SfDataGrid.SelectionChanged event. Please refer the following code example.
Code example :
|
parentDataGrid.SelectionChanged += parentDataGrid_SelectionChanged;
void parentDataGrid_SelectionChanged(object sender, Syncfusion.WinForms.DataGrid.Events.SelectionChangedEventArgs e)
{
var data = this.parentDataGrid.SelectedItem as OrderInfo;
this.childDataGrid.DataSource = data.OrderDetails;
} |
We have prepared a simple sample with single details grid for your reference and it is available in the following link.
If your sample have two or more details grid, you need to add separate TabPage and SfDataGrid for each details grid. Currenty we are analyzing the feasibility to achieve this behavior generically based on the number of details grid. We will update you with further details on January 30, 2019.
Regards,
Mohanram A.
AK
Alfred Klein
January 29, 2019 06:40 PM UTC
Hi Mohanram,
thank you for working on my thread.
Your example-solution is exactly what I was looking for.
Thank you for your help!
Best regards
Alfred
JN
Jayaleshwari N
Syncfusion Team
January 30, 2019 12:28 PM UTC
Hi Alfred,
Thanks for the update.
We have modified the sample generically based on the property info and created child data grids. We have attached the sample for your reference and you can download the same from the following location.
Please let us know if you would require further assistance.
Regards,
Jayaleshwari N.
AK
Alfred Klein
January 31, 2019 07:43 PM UTC
Hi Jayaleshwari
thank you for that new example. It is a very interesting approach.
At the moment I don't need more help.
Thanks again and best regards
Alfred
JN
Jayaleshwari N
Syncfusion Team
February 1, 2019 05:08 AM UTC
Hi Alfred,
Thanks for the update. Please get in touch if you would require further assistance.
Regards,
Jayaleshwari N.
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
AK Alfred Klein
- Jan 25, 2019 08:32 PM UTC
- Feb 1, 2019 05:08 AM UTC