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 Details Generic CRUD

Hi, I have many Master Detail Table

Projects - Tasks
Customer - Order etc.

  • How can I let user edit/CRUD both Master and Details (show user success message when done)
  • Since I have many Master-Detail tables, I don't repeat the code everytime, is there a way to create a generic Master-Details Edit/CRUD?

Thanks


3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team August 22, 2017 01:57 PM UTC

Hi Megatron, 

Thanks for contacting Syncfusion support. 

According to your requirement you have many Master-Detail Grid and you need to display success message when we successfully completed CRUD operation in Master-Detail Grids.  

In this you have mentioned that you do not repeat the code every time. So, here we have some clarifications. 

1. If you are using remoteSave adaptor in Grid, then do you need to apply the same URL for all Master-Detail Grid?. 

2.  Please provide more information regarding the repeat code.  

Regards, 
Prasanna Kumar N.S.V 



ME Megatron August 22, 2017 04:45 PM UTC

1. If you are using remoteSave adaptor in Grid, then do you need to apply the same URL for all Master-Detail Grid?. 
yes - URL will change by location of controller action

2.  Please provide more information regarding the repeat code. 
I was hoping to load Generic Master Object/Model, and Generic Detail Object/Model in the Grid View code & controller.
So, I am trying to reuse code. I would like some suggestion/input from you on how to make the Master Grid CRUD in a reusable pattern.
  • Option 1: Either copy and paste the same code
  • OR 2: Ceate a new object to pass configuration values in the my view/partial view & controllers to setup the Views for each master Details grid..

3. I want to let user Edit Both Master Grid & Details Grid, Add new records, edit, delete. (In the delete/Edit Row Master Grid, if there are records under details Grid, I want to show message to User
  • Message to user when deleting Master Records to prevent orphaned records -" Do you want to move the child records to another Master Record?"
  • Yes - then show Dropdown or something on which record - select a different Master Record to make as the parent record for that Child/Details record.
  • No - then prevent deletion

Thanks




PK Prasanna Kumar Viswanathan Syncfusion Team August 28, 2017 01:42 PM UTC

Hi Megatron, 

Sorry for the late reply. 

We have some clarifications with your requirement.  

1. Query : “URL will change by location of controller action” 

In above query if we bind the different table for the Master-Detail Grid, then you need to use same CRUD controller action for both Master and Detail Grid. If we misunderstood your query, please provide the graphical representation of your requirement.  

2. Query : “Ceate a new object to pass configuration values in the my view/partial view & controllers to setup the Views for each master Details grid.. 
 
We cannot understand the above requirement clearly. So, please provide graphical representation for this.  
 
3. Query : “Delete operation” 
 
In this if we delete the record in Master Grid you need to open the dialog box with Yes or No option. If we select yes you need to show the dropdown with the values of an primary key values(Master Grid). If we select the value from the dropdown then you need to move all the records of detail Grid to the selected Master record.     

Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon