Reputation: 8650
I would like to know if it's possible to add a data()
variable for each rows using the jquery datatables.
It's possible to do it using jquery but i want to know if it's possible to do it using the plugins.
something like that.
var t = $('.table').dataTable();
t.row.add([
1,
2,
3,
4,
]).draw().data('id', 1);
Upvotes: 0
Views: 486
Reputation: 48357
For custom format,I used fnCreatedRow . Further more,for your example you need something like this:
var t = $('.table').dataTable({
"fnCreatedRow": function (row, data, index) {
$(row).attr("id",1);
}
});
Upvotes: 1