Appending html to datatables columns after draw
Appending html to datatables columns after draw

Is there any easy way to add a div or span to a specific column index's data?
So if I have an array of columns 1,3 and I want to add a div surrounding those columns data how would I do that? Thank you.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
As I'm thinking about it I believe another solution would be if I could just add a class to the <td> that contains that row's data. In fact I think that would be the preferable solution.
You can use
columns.className
to add the class name to atd
.Kevin
Is it possible to invoke that method after the table has been created through the API?
I believe I got it to work like this, is using columndefs twice proper syntax?
You can use
createdRow
orcolumns.createdCell
. If the data can change then you can userowCallback
.Kevin
Sounds good, thank you!
One last question, is there any easy way to avoid applying the class to the column headers?
The class name would be on the header if you use
columns.className
, if you use one of the three options Kevin suggested in his last mail, any class applied there would only go on thattd
element.Colin
Thanks again.