Style icon in selected row in datagrid

I have a datagrid with a custom column that has an icon in it. I am trying to figure out how to change the style of that icon when it is clicked, but only for the row/item that is clicked. More details in loom. Thanks!

It’s like how you do conditional styling for other elements in weweb.
The only difference is that you need an unique id for the row/item, but the data grid already requires an unique id.
Keep track of the selected row/item. Depending of your logic you can use the built-in “selected rows” of the data grid or another variable that you update with the row id on click.
Set the different style based on the condition that the selected row id is the current row id. You can bind directly the properties that you want to change or add a state.

1 Like

Thanks @dorilama that worked :grinning:

1 Like