add images to the datatable column
add images to the datatable column
denizdiana
Posts: 15Questions: 8Answers: 0
Hello everyone,
I have a datable and I want to add something to it. I fill my datatable from json object,
var table = $('#table').DataTable(
{
ajax: {
"url": "url",
"type": "GET",
"datatype": "json",
"dataSrc": "data"
},
aoColumns: [
{ mData: 'name' },
{ mData: 'isOn' },
{ defaultContent: '<input type="button" class="Edit" value="Edit"/><input type="button" class="Delete" value="Delete"/>' }
],
});
If isOn is true, I want to add green circle in that column,if false, i want the red one. How can i do that?
Thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use
columns.createdCell
orcreatedRow
but if the data can change then userowCallback
. See if the examples in the docs help.Kevin