Hello Infragistics Team,
We are using the React Hierarchical Grid component (v18.7.7 URL) in our project and need to programmatically expand or collapse rows.
We attempted to use hierarchicalGridRef.current.expandRow(value), but it only expands the first row(parent row) and not its child rows. We want to expand the child row also.
Could you provide an example with code demonstrating how to expand/collapse all rows, including child rows?
Thanks in advance!
Hello and thank you for contacting Infragistics. At the moment there doesn't appear to be direct way to access child records to expand them for a particular parent record. I asked a team member to review this with me to see what our options are. I will follow up soon with an update. Let me know if you have any questions.
Okay, this in fact works, but keep in mind expanding all parent rows at once can be pretty costly, and not advisable if it can be avoided.
It's more performant to hook the gridCreated event in markup inside the RowIsland(s) and the approach above is not the intended approach to do this.
eg.
Hello Michael,
Thank you for your response and for looking into our issue.
We have implemented the code changes you suggested, and it is working fine. However, we have noticed a performance degradation, even with small datasets.
In your previous comment, you mentioned:"Okay, this in fact works, but keep in mind expanding all parent rows at once can be pretty costly, and not advisable if it can be avoided."
Could you please elaborate on why this approach is not advisable? We have a feature that relies on expand/collapse functionality.
Is there an alternative approach that would maintain grid performance without causing degradation?
Looking forward to your insights.
I responded with another update to use the gridCreated event and expand the parent records by ID.
this.hierarchicalGrid1.actualChildLayoutList[0].expandAll();
This collection is supposed to be internal and not public.
Please confirm using this approach this.hierarchicalGrid1.actualChildLayoutList[0].expandAll(); will degrade the grid performance?As earlier mentioned by you it is not recommendable.
Correct, please don't use this but instead use the gridCreated event.
<IgrRowIsland
Any update on this?
Its because you are now calling updateRow in a loop and gridCreated event is constantly firing as a result. While I still believe this might be machine specific to explain the 4-5 seconds (I don't see this delay), the grid does lock up on scrolling and live row updating has introduced more performance issues as I warned about happening earlier. I let our senior developer know and I will update with any useful tips if there are any. But for now my recommendation is to hold off doing live updates in this manner and/or simply update your data instead of updateRow on the grid. Keep in mind I am not aware of any way to suspend gridCreated when updateRow is also called but if I find anything useful I will let you know.
Please try this example (link) and let us know if you experience any UI freezing issues. We have tested it on different machines and observed a 4 to 5-second freeze after expanding or collapsing a row.
I am not noticing this. About a second or two at the max. Do you have another machine you can test this with?
Thanks for your confirmation.
We have created an example (link) demonstrating row expansion and collapse using a button. However, we are experiencing a UI freeze for 4 to 5 seconds after expanding or collapsing a row.
Please investigate this issue and provide a fix.
Thanks!