Is it possible to add a title (or other attribute) to an individual cell using columns.render
Is it possible to add a title (or other attribute) to an individual cell using columns.render
I've been using columns.render to insert html elements into an individual cell, doing something like this in the table/columndefs definition:
"render": function(data,type,row){
return data === 1 ? "<img src='../images/complete.gif'>" : "<img src='../images/complete_disabled.gif'>";
}
However, I'd like to be able to attach a title attribute to individual cells, but I can't figure out how to get a reference to the cell within the render function. Is there a way to do this in the table definition, or do I have to add this after the table is defined using something like rows().every()?
This question has an accepted answers - jump to answer
Answers
columns.render
lets you manage what is showing inside the cell only - it does not allow modification of the node itself (this is because the node might not be created until after the rendered data is required).Use
columns.createdCell
, or the API as you suggest, to manipulate the DOM elements.Allan
createdCell was what I was looking for. Thanks much!