using createdRow to conditionally add class, but won't work on FIXED Columns

using createdRow to conditionally add class, but won't work on FIXED Columns

thegamechangerprothegamechangerpro Posts: 81Questions: 30Answers: 1

I have been using the following to apply row coloring based on cell value, which has been working great. It doesn't seem to be working on fixed columns though. Is there something special that I need to use to apply classes to fixed column rows?

https://jsfiddle.net/thegamechangerpro/wutx04jz/38/

Also,
I want to addClass to a row conditionally after a specific cell is edited without redrawing.
I thought all I would have to do is add a conditional statement with a $(row).addClass('classname'); in my createdCell function (line 106) -- but It doesn't seem to work. Is there a better way to do this? I have a createdRow action going on but it doesn't update the row after an edit (without a whole redraw).

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    I think due to the way Datatables manipulates the DOM to display the fixedColumns you need to apply the class to all the td elements in the row instead of the tr. Change $('row).addClass( 'grey' ); to $('td', row).addClass( 'grey' );. Like this:
    https://jsfiddle.net/01fct73o/

    Kevin

Sign In or Register to comment.