Cell Styler Nanoflow (dynamic colors)

Hey guys, I am wondering if there is a way to optically seperate different objects in a dynamic way.  Here is what this is about: I have a data grid with different Functions listed: Example table: Function: A A B B B … To make the grid easier to read, I would like to color all rows which have different functions in an alternating way. For example all rows with function A are white, all rows with function B are grey,…. I used the cell styler widget with different nanoflow like this with the expression $Function/functiontitle = ‘A’ and it works. How could I make this progress dynamic so I am not dependent on a certain function? The function can change by time and I am not ablte to know how it will be spelled in the future. It somehow has to be a variable but I have no idea how to do that. Another problem: The cell styler is limited to nanoflow an JS.  Any ideas? Many thanks! :)
1 answers

Start by adding an extra attribute to the entity you show in the grid. Before posting it on the page, sort the objects by ‘Function’ and loop over it and give the new attribute a color name. Change to a new color name when ‘Function’ differs from the previous ‘Function’.

Given that ‘Function’ has a limited number of different values (say no more than ten or so) you can make sure that you have a set of colors that are easy to differentiate. Basic colors will do, green, blue, purple, red, yellow etc.

Now, use the cellgridstyler on the new column, which you need not even show.

Hope it helps, good luck.