Hey everyone, I am trying to change the color of a couple cells in a app listing table row depending on certain conditions. I have the logic in place and the CSS as well, but something is not triggering Plone to push the class change to the front end. I can get the entire row to change by doing
if logic here:
item["state_class"] = "css-class"
Same thing goes for say the state title
if logic here:
item["state_title"] = "test"
I know that the dictionary of items for app listing contains this:
’class’: {‘column a’: , ‘column b’: }…etc
So I have tried
if logic here:
for col in ["column a", "column b"]:
item["class"][col] = "css-class"
This changes the dictionary output to be:
’class’: {‘column a’:'css-class', ‘column b’:'css-class'}
But the css does not get appended to the cell on the front end like it does for the row from before. Can anybody help me out with what I am missing?
UPDATE: I got this resolved. app.listing does not natively check for changes to item class, so this code in TableCells.coffee was essentially saying “hey, don’t even look at the dictionary, just use the same css class name every time”
css = "contentcell #{column_key}"
So adding this
if item.class? and item.class[column_key]?
css += " #{item.class[column_key]}"
And running yarn build in the path/to/senaite.app.listing/webpack directory fixed it