How can I access the cell being rendered?
How can I access the cell being rendered?
Datatables 1.12.1.
I'm using the 'columns' options/config. Is there a way to access the <td> or the <th> that is rendered by Datatables? The columns.render() function gives me access to manipulate the data, but I dont see a way to get at the <td> or <th> cells so that I can add custom classes to it. I'm using Datatables with jquery in case that provides an easier solution.
I know I can return a div within the column.render function, but this seems extraneous/excessive when I just want to tag specific td cells with a class for styling based on the data contents. Have I overlooked an api/function/callback that will give me access to the table <td> at rendering time?
This question has an accepted answers - jump to answer
Answers
I think you need createdCell:
https://datatables.net/reference/option/columns.createdCell