Conditionally set table row text color with currentRow

Hello,

I'm having difficulty conditionally setting the text row colour with the new tables.

I've tried this which I believe worked in the past:

This returns this error: ReferenceError: currentRow is not defined - try using the shortcut ⌃SPACE to show an autocomplete menu.

Is this no longer possible with the new tables? Is there something that can achieve this desired effect?

Thanks for any help you can give! :pray:t2:

Alex

Ah, two different things happening:

currentRow has become currentSourceRow see this

That said, Row Color is not supported in the new table (at least not yet, but fingers crossed, because I have used it too, and was similarly looking for it).

1 Like

Thanks Schteevynn!

1 Like

Hi @AM-BE - as an update, in case this fits your use case, customizing background color of cells in Table is now possible in both Retool Cloud, and the latest Retool self-hosted release (version 3.6) in the column-level Appearance > Background setting. Check out @AnsonHwang's comment here describing how to do this using item

I've separately linked this post to a feature request internally to conditionally set _text_ color (not only background color) but I don't currently know of plans to support this. Hopefully background color settings will help get you close to what you're looking for in the meantime!

There's also status indicator functionality if that's closer to your use case than column background color for now :thinking: Will also keep you updated here if there's movement toward supporting conditional text color

Adding on here! If you'd like to change the text color of only the selectedRow, you can use some custom CSS (docs and community forum guide).

Here's the code I'm using:

#table2--0 li[aria-selected=true] div {
  color: red;
}

You'll likely just need to change the table name in the CSS for it to work on your end. Let us know if you have any questions! :hammer_and_wrench:

1 Like