Hello, sorry for the late reply (4 years!), better late than never.
In your example you provided, the updating of the child data unfortunately causes the hierarchy to all reset back to level 0 only (all children closed)
James
Hi James,
Query 1: Is there any way to update the data in a child grid without the hierarchy all resetting?
We understand your concern about expanded rows being automatically collapsed after update the child grid data programmatically. Want to prevent the collapse in the first place. The behavior you described is indeed the default functionality of the hierarchy grid. When data was updated, resulting in changes to the underlying data source, the grid undergoes a re-rendering process. During this process, any previously expanded rows are collapsed as part of the default behavior.
Query 2: Is it possible to get the Grid object of the child grid?
We can get both child grid instance from the created event of the child grid or the detailDataBound event of the parent grid. The code snippet of the implementation and sample have been attached for your reference.
app.component.ts
detailDataBound(args) { var childGridInstance = args.childGrid; //childGrid instance console.log(childGridInstance); } created() { var childGridInstance = this; //childGrid instance // console.log(childGridInstance); } |
Sample: https://stackblitz.com/edit/angular-f151306-7vkmal?file=app.component.ts
Created: https://ej2.syncfusion.com/documentation/api/grid/#created
detailDataBound: https://ej2.syncfusion.com/documentation/api/grid/#detaildatabound
Please let us know if you need any further assistance.
Regards,
Vikram S