Sorting breaks rowRender
Sorting breaks rowRender

I have logic that picks particular rows I want to give a CSS-class, but when I use sorting that is different to the initialized one, the class gets applied to the wrong row.
How is this fixable?
Is it possible to add class to the parent <tr> when using the ["render" : function]? (This would be the easiest as I am styling the text in the <th> and want to give this row a background color.
This discussion has been closed.
Replies
I'm assuming this is a duplicate to your question in this thread?
https://datatables.net/forums/discussion/46697/adding-a-class-to-a-row-on-datatables-initialization#latest
If so please don't duplicate questions.
columns.render
is intended for data. To manipulate thetr
you can usecreatedRow
or if the data changes userowCallback
. You can also usecolumns.createCell
for thetd
.If this doesn't help then please post a link to your page or a test case replicating the issue. This will allow us to see what you are doing to help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thank you verry much. createRow was what I needed
Sorry about duplicating my question; As I saw that the post was over a year old I posted this here. Won't do it again.