You are viewing limited content. For full access, please sign in.

Question

Question

Change table row readonly field color based on value

asked on January 29, 2024

I have been looking over the Answers forums for the right CSS JavaScript combination without luck. 

What I am trying to do is change the color of each row. The fields are readonly. 

The table is '.ratingtable' and the rating field number is '.rating'.

If anyone can point me in the right direction, that would be appreciated.

Jonathan

0 0

Replies

replied on January 30, 2024

In the v11 Modern Designer, we're using this CSS to alternate the color of each table row (light purple and dark purple:

// change table button color (alternate rows)
.costingTable tr:nth-child(even) .lf-icon { color: rgb(255, 255, 255); }

// alternate table tr background colors - odd
.costingTable tr:nth-child(odd) { background-color: rgb(227, 219, 236); }

// alternate table tr background colors - even
.costingTable tr:nth-child(even) { 
  background-color: rgba(73, 43, 116, 0.6);
  color: initial;
}

// alternate table tr background colors - even - currency unit
.costingTable tr:nth-child(even) .currency-unit { 
  color: white;
}

 .costingTable .fl-component input:not([type="checkbox"]):not([type="radio"])[readonly], .fl-component textarea[readonly] {
  background-color: #f5f2f8 !important; 
}

Also worth noting is that you can apply classes using Field Rules in v11, so if you need to only change the row color conditionally, you could apply the CSS class based on a field value (for example). 

add_css_class.jpg
2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.