When committing transactions in the child-grid (IgxRowIslandComponent) after having committed transactions in its parent-row in the hierarchical-grid (IgxHierarchicalGridComponent), the changes contained in the child-grid transactions are not applied at all to the data property.Following code should really do the trick but it does not solve the problem:this.hierarchicalGrid.transactions.commit(this.data); this.childGrid.hgridAPI.getChildGrids().forEach((grid) => { grid.transactions.commit(grid.data); });
this.hierarchicalGrid.transactions.commit(this.data); this.childGrid.hgridAPI.getChildGrids().forEach((grid) => { grid.transactions.commit(grid.data); });
Hello,
Thank you for following up.
I have been looking into the StackBlitz sample and I can see that it is essentially the same as from the Angular Hierarchical Grid Batch Editing and Transactions Example topic demo here, with the only difference that the primary key of the parent grid has been changed to “Artist” instead of “ID”, so the former is editable.
Just so that we are on the same page, I would like to mention that it is expected that a child grid’s edited row will not be added to the transaction log and respectively committed in case it has not exited row editing mode (either by pressing the row editing overlay “Done” button, or programmatically calling the endEdit method).
Looking at the demos, I was able to reproduce the child grid edited data not being committed, even though the transactions are shown in the commit dialog’s transaction log. The sample’s current behavior has been logged for further investigation and I will update you as soon as there is additional information about its possible cause.
Meanwhile, a working solution involves wrapping the method call into a requestAnimationFrame() call:
this.childGrid.gridAPI.getChildGrids().forEach((grid) => { requestAnimationFrame(() => { grid.transactions.commit(grid.data); }); });
Optionally, the child grid’s endEdit() method could be called before opening the commit dialog, in order to automatically exit edit mode for the child grid's edited row (without pressing the “Done” button in the row editing overlay).
Please, test the modified sample (here) on your side and let me know how it behaves.
Best regards,Bozhidara PachilovaAssociate Software Developer
Here is an isolated sample demonstrating the issue that still persists in the StackBlitz: https://stackblitz.com/edit/angular-hofkzt?file=src/app/hierarchical-grid/hierarchical-grid-batch-editing/hierarchical-grid-batch-editing.component.tsIn this example if you changed the artist name from 'Naomí Yepes' to for example 'J Cole' and and the name of the artists album from 'Initiation' to 'Born Sinner' and commit the changes, you will find that the name of the artist have changed but not the name of the album. However, if you solely change the name of the album and then commits the change then you will find that the name of the album now have been changed without any issue.According to me, this behaviour is not correct as in that all the changes made, from the child to the parent records, should be committed without omitting the changes made to child records or am I wrong?
I have been looking into your question and I can see that this code-snippet quite resembles the code within the commit method in the Hierarchical Grid Batch Editing and Transactions Example in our documentation here. At first glance, what I can say is that the demo uses the “gridAPI” member to access the IgxHierarchicalGridAPIService, instead of the “hgridAPI”. After quick investigation, I determined that this member has recently been updated with the name “gridAPI”. Considering that the hierarchical grid batch editing is working as expected in the demo, my suggestion is to refactor the snippet with the “gridAPI” member.
If the issue still persists, it will be highly appreciated to provide an isolated sample demonstrating it. Ideally, please, fork and modify the StackBlitz sample from the above referenced topic and send it back to me along with steps to reproduce.
Please, keep me posted on your progress.