Child Row Conditional Formatting

Child Row Conditional Formatting

trongarttrongart Posts: 222Questions: 51Answers: 0
edited September 2021 in DataTables 1.10

This test case has child rows that are all open after the table loads:

live.datatables.net/voyanulo/1/edit

Every child row has an "extn_class" which I would like to use to control the text color of the last numerical part of the child row (the remaining text of the child row should stay red). My goal is to change the text color to orange if Extn >= 5000. For main rows this is controlled by using 'createdRow' and "$(row).find('td:eq()')", but I'm not sure how to do this for child rows analogously.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,322Questions: 26Answers: 4,774
    Answer ✓

    Datatables doesn't know about this row so things like createdRow won't have access to it. You are using the format function to display a div with the output. You will need to place logic in the format function to manipulate the HTML you want to display / return for display.

    Kevin

  • trongarttrongart Posts: 222Questions: 51Answers: 0

    This works- thank you for guiding me in the right direction!

Sign In or Register to comment.