Is there a way to listen to Grid item details expand / collapse event?

I’m looking for a way to listen to when grid item details are shown / hidden.
In the specific scenario, I have an icon button in a cell that should be changed based on whether details are visible for this row.
The details can be expanded on row click or on icon button click.
What’s the best way to do it?
I don’t see details specific expand / collapse listener. So best way I can think of is listening to both icon button click and item click listener and check whether for given row the details are visible or not grid.isDetailsVisible(row). But then I guess I need to update all the buttons to have correct icon, or somehow compare that for given row the icon is correct (not sure how to do that) and only update the necessary one.

Looking at the source code, Grid automatically refreshes items that have been expanded or collapsed. So if you use a custom renderer that should be triggered again automatically as well, in which you could then check whether the item is expanded or collapsed and render content accordingly.

1 Like

@sissbruecker thanks! That did the trick!

1 Like