In the doc regarding Load on Demand for Hierarchical Grid, event onGridCreated is fired when a Row is expanded.
After expansion, the event is no longer triggered, since the grid is already created.
Is there a way to trigger the event every time a row is expanded, or be able to destroy the inner grid when the row collapses?
Doc: https://www.infragistics.com/products/ignite-ui-angular/angular/components/hierarchicalgrid/load-on-demand
Thanks
Hello,
I have investigated your requirement, and I have asked our engineering staff to examine this further. What I determined is that with performance in mind, once a child grid is created it is cached in private property and even if you destroy it manually it would not be re-created once the parent row is expanded again. Having said that, at this point creating/destroying child grids is not provided out of the box.
An approach I could suggest is to use a Master-Detail Grid and to declare a new (child) grid in its template. However, this should be done for all levels in your hierarchy. After the templates are declared you could create/destroy them on expand/collapse.
Here could be found more details about Master-Detail Grid. Let me know if I may be of any further assistance.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
Hi Teodesia,
Is there any news on my request?
Thanks in advance.
I had tried onRowToogle event before onGridCreated, but the first time the row is expanded, the child grid appears empty even tough the data is fetched from remote service and binded to the grid. After collapsing and expanding again, the child grid shows the data.
Thats why after that I tried the onGridCreated approach. But I need the grid to be re populated every time the Row Island is expanded. In the sample you provided, the data is only fetched once.
Is there a way to fullfill my need?
I have been looking into your question and an approach I could suggest is to use the IgxHierarchicalGrid onRowToggle event. It would be emitted when the expanded state of a row gets changed. However, please keep in mind, that initially when the child grid is created, the event is fired before onGridCreated event.
Also, the event should be defined for each row island.
Here could be found my sample for your reference. Please test it on your side and let me know if I may be of any further assistance.