How to manipulate "" when populating data.
How to manipulate "" when populating data.
xXSkeith22Xx
Posts: 7Questions: 4Answers: 1
it populates a td with no attribute at all. wanted to add id on it
dataTable.dataTable({
data: obj,
columns: [
{ data: "code" },
{ data: "name" },
{ data: "unit" },
{
data: function(obj) {
return "<td id='"+obj.id+"'>\
button
</td>";
}
}
]
});
This discussion has been closed.
Answers
You can't do that I'm afraid - the return from the data function (which you probably shouldn't use - use
columns.render
as a function instead so you don't have to deal with the complication of the set case) gets inserted into the cell.If you want to add an id to a cell, use
columns.createdCell
.Allan