How can I add a cssclass to a field in table based on next field value ?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
Hi, I am using table component to display records (which have multiple records and fields). I want to compare First field value with Second field value and want to change the color of  field text which have a small value.

Ex: If 1st field value = 4, 2nd field value = 8. In this case i have to change the 1st field text color. 

I have to do this for all fields (1st with 2nd, 3rd with 4th, 5th with 6th.... 19th with 20th) in multiple records. 

Let me know the easiest and perfect way to do this. 

I did this after rendering the table, using jquery each function by comparing the td values. But it is working at the time rendering table, not able to change when user clicked on pagenation buttons.

Looking for snippet which we can run at the time of field rendering (running snippet in custom rendering condition), so need to worry about the pagenation also.
Photo of Vijayakrishna

Vijayakrishna

  • 642 Points 500 badge 2x thumb

Posted 1 year ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
You'd have to create a field renderer in javascript. The parameters provided would allow you to evaluate the row and all it's field values.