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 and Details edit inline

Hi,

I've a Master and Details grids, but I need edit inline de Details grid. But when I add a new element, I don't have the ID of Master in Insert Action

Thanks

3 Replies

RU Ragavee U S Syncfusion Team December 22, 2016 12:54 PM UTC

Hi Manolo, 

Thanks for contacting Syncfusion support. 

As we have rendered the detail grid based on the row data of the selected row. So, we can get the relational value and set it when adding a new record to the detail grid using the actionBegin event of the Grid. 

Please refer to the below code example. 

rowSelected: function (args) {//rowSelected event of master grid 
    employeeID = args.data.EmployeeID;//get the primary key value of master grid 
    var detaildata = ej.DataManager(window.gridData).executeLocal(ej.Query().where("EmployeeID", ej.FilterOperators.equal, employeeID, false).take(10)); 
    var gridObj = $("#DetailGrid").ejGrid("instance"); 
    gridObj.dataSource(ej.DataManager(detaildata.slice(0, 5))); 
}, 
 
//actionBegin event of detail grid 
actionBegin: function (args) { 
    if (args.requestType == "save") { 
        alert(args.data.EmployeeID); 
    } 
    else if (args.requestType == "add") { 
        args.data["EmployeeID"] = employeeID;//assign the column value with the primary key value of master grid 
    } 
}, 


Regards, 
Ragavee U S. 



MA Manolo December 28, 2016 07:11 PM UTC

Perfect! Thanks a lot!


RU Ragavee U S Syncfusion Team December 30, 2016 04:34 AM UTC

Hi Manolo, 
  
Thanks for your update. 
 
We are happy that your requirement is achieved. 
  
Regards, 
Ragavee U S. 


Loader.
Live Chat Icon For mobile
Up arrow icon