Hi Andrea,
Thanks for using Syncfusion Products.
We are glad to let you know that your requirement(“While editing in child grid update parent record also without collapsing the child Grid”) can be achieved by updating the parent Grid record using “updateRecord” Grid method in the “endEdit” event of child Grid. Please refer the following code snippets
@(Html.EJ().Grid<object>("HierarchyGrid") .... .ChildGrid(child => { ... .ClientSideEvents(eve => eve.EndEdit("edit")); }) )
function edit(args) { var obj = $("#HierarchyGrid").ejGrid("instance") var tr = this.element.closest("tr").prev("tr"); var index = obj.getIndexByRow(tr); var rec = obj.model.currentViewData[index] this.refreshContent(); var count = this.model.dataSource.filter(function (e) { if (e.Verified && e.EmployeeID == args.data.EmployeeID) return e }).length; rec.TrueCount = count;
obj.updateRecord("EmployeeID", rec); } |
For your convenience we have created a sample and the same can be downloaded from below link.
Sample: http://www.syncfusion.com/downloads/support/directtrac/118488/EJGrid1444397340.zip
In the above sample, in parent Grid we have a column that holds the count of true values in child Grid Column. When we edit the Boolean column in Child Grid we have updated the parent Record.
Also while creating the sample we faced issues “On updating Parent Grid record, its expand icon changes to Collapse icon” & “Total record count issue with updating record in child record”. We have logged defect report for this issue. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
But as workaround we have resolve this issue in the above sample by manually changing the collapse icon to expand and calling “refreshContent” Method. Please refer the following code snippets.
function edit(args) { this.refreshContent(); obj.updateRecord("EmployeeID", rec); // To resolve total record issue in child Grid tr = this.element.closest("tr").prev("tr"); tr.find(".e-detailrowcollapse").attr("class", "e-detailrowexpand"); tr.find(".e-gnextforward").attr("class", "e-icon e-gdiagonalnext"); } |
Please let us know if you need any further assistance.
Regards,
Alan Sangeeth S