SfDataGrid MasterDetailView set up.

I am new to syncfusion and programming in general. I downloaded the community version of Syncfusion to learn how to build enterprise programs. I am attempting to make a nested table that shows items attached to jobs in the grid much like the example project: 

http://www.syncfusion.com/downloads/support/directtrac/general/ze/2230681599446808

Though, after examining this sample I cannot find why or how it works. I do not see where the relations are hooked up or how I get a column on the master table, and a column on the detail table to be related. I also don't understand where the details table comes from, as in this project there is only 1 SfDataGrid, and I see no DataTables being added. Some help in the right direction would be greatly appreciated.

I have attached some screenshots of my project for visual information. I connect to two locally hosted test databasses, one with the inventory, the other with the jobs. The Jobs have a Number column I want to relate to the Allocation ID (allocId) column of the inventory database. I use a DBConnect class amde by myself to connect to both the databases and preform CRUD operations. 

Please let me know if more information needs to be provided or if a zipped project would be more helpful.

InventoryTab.PNG

JobTab.PNG


7 Replies 1 reply marked as answer

JA James November 16, 2021 10:01 PM UTC

I forgot to attach the CS Files to the original.


Attachment: CSfiles_affba226.zip


MA Mohanram Anbukkarasu Syncfusion Team November 17, 2021 02:58 PM UTC

Hi James, 

Thanks for contacting Syncfusion support.  

We would like to let you know that the Master-Details view relations can be created either manually or automatically. GridViewDefinition.RelationalColumn is used to make relation between the master-details view manually. All these details are documented in our help documentation. We request you to refer the below given help documentation to know more in details about the Master-Details view in SfDataGrid.  

UG reference :  

Please refer the help documentations and let us know if you require further assistance from us. 

Regards, 
Mohanram A.  



JA James replied to Mohanram Anbukkarasu November 17, 2021 06:31 PM UTC

As mentioned I've only been programming in school for a small amount of time. That documentation does contain helpful information, but since I do not know the techniques they were meant to replace I do not know how to use them nor how to adapt them to my project. From what I gathered I need to create a DataSet of the two DataTables I'm already getting, add a relational column, and then display them on my "jobs" tab SfDataGrid. I've been pouring over those documents for a few days now. Even downloading samples and poking around. I still cannot grasp the concept. 



MA Mohanram Anbukkarasu Syncfusion Team November 18, 2021 02:49 PM UTC

Hi James, 

Thanks for the update.  

Please refer the sample from the below given link that includes creating of DataSet and creating relation using two DataTables. 

Kindly go through the guidelines completely and let us know if you are facing any difficulty in implementing any of the solution provided in our documentation. So that we can provide more specific details to resolve the hurdles and to achieve your requirement in your project. 

Regards, 
Mohanram A. 


Marked as answer

JA James November 18, 2021 10:30 PM UTC

It makes a little more sense now. I can see what is going on in this example. Yet when I adapted it to fit into my project the details were still not shown beflow the master. I tried changing the function to return a dataset to see if that would fair better instead of returning the first table in the dataset index but that did nothing either. Im getting my jobs table through this method, but it does not seem to be displaying the related items from the items table. 


This is my current code with the edits I made. The results are the same as before the edit to return a DataSet instead of the DataTable at index 0.



JA James November 18, 2021 10:51 PM UTC

Okay found my problem after your answer, I had to have relations autogenerated.



MA Mohanram Anbukkarasu Syncfusion Team November 19, 2021 10:44 AM UTC

Hi James, 

Thanks for the update.  

We are glad to know that you have found the solution for your problem. Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Loader.
Up arrow icon