Hi,
We want to do some manipulations for the specific row (igx-hierarchical-grid:parent grid), when the child grid (igx-rowisland) is expanded. There are properties related to expanded in the infragistics documentation but there is no event for the toggle/expand/collapse in igx-hierarchical-grid.
Please assist with the possible solutions to achieve the functionality.
Thanks,
Ishani
Hello Ishani,
Thank you for posting in our community.What I can suggest for achieving your requirement is working with hierarchicalState property that IgxHierarchicalGridComponent class provides. This is an array consisting of all toggled rows. The state of this collection can be tracked for any changes. When such a change occurs, this means that a row was toggled. This row was either expanded or collapsed, however, in both cases the hierarchicalState array is updated. A working sample illustrating my suggestion can be found here.
https://stackblitz.com/edit/angular-6byo8k
What we have in this sample is an iterable needed to determine changes in the hierarchicalState array. It is created into the constructor of the component and is used at later stage to initialize a differ (See angular.io/.../IterableDiffer for reference). The differ could be used to determine whether the array of toggled rows has changed. Having this, one could easily determine which rows are collapsed, expanded etc.
Please do not hesitate to contact me if you need any further assistance.
Best regards, Petko
Hi Petko,
Thanks for your assistance.
We are making asynchronous calls to get data for the grid. Is there any alternative to use the hierarchical state array in other methods and not in ngDoCheck() ?
I'm so glad to hear that you have find a solution to your problem.Feel free to ask for any further questions regarding our products.
Best,
Petko Bozhinov
Hello Petko,
Thanks for the solutions. I have resolved my issue using onGridCreated event.
Hey Ishani,
Thanks for coming back to me!NgDoCheck is the way to actually watch for a change in a collection, so if you are just trying to mock such an event, that’s the way.If you’d like to provide the grid with data on demand, you may wish to get to know the Hierarchical Grid's Load on Demand Feature, which allows you to use onGridCreated event.If that’s not the case, please send me a sample and a detailed description of what you’d like to achieve.
Thank you,Petko Bozhinov