How do I get the cells of a row from the row() api inside rowCallback?
How do I get the cells of a row from the row() api inside rowCallback?

Use case: I want to modify CSS classes of cells in the rowCallback.
So, code should look like this:
rowCallback: function (row, data, dataIndex) {
var cell = <find cell at col index 17 for this row>
if(something) {
$(cell.node()).addClass('red');
}
In many examples, it is done like this:
$(row).find('td:eq(17)').addClass('red');
But this does not work if some columns are hidden.
Current workaround for me:
var rowIndex = this.api().row(row).index();
$(this.api().cell(rowIndex, 17).node()).addClass('red');
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @tom99 ,
Yep, not a workaround, that's the way to go!
Cheers,
Colin
Nice to hear and thanks for the quick answer. :-)
Although I thought, it should be easier to do with less code. ;-)