How can I change the background color of a row in a list when its item.index is odd?

I need the rows in the list to have different background color depending on whether their index is odd or not.

You need to use the % modulo operator like this, if(item.idex % 2, "color_1", "color_2");

I also talk about these kind of methods in my blog post by the way.

1 Like

thank you

1 Like