DT 10 - Row Render
DT 10 - Row Render
deliator
Posts: 95Questions: 1Answers: 0
Hi,
In my example below, if date is lower than today it will be render in bold red. This work fine.
But i will apply the class BoldRedColor to all the cells of the row.
Any suggestion ?
columnDefs:[
{ targets: [ 0, 1, 2, 3, 4, 5], visible: true, searchable: true },
{ targets: [ 6], visible: true, searchable: false },
{ width: "50px", "targets": [6] },
{ width: "110px", "targets": [4, 5] },
{ width: "130px", "targets": [3] },
{ width: "80px", "targets": [0] },
{ render: function (data, type, row) {
if (data === 'Yes')
{return '<span class="fa fa-check"></span>';}
else if (data === 'No')
{return '<span class="fa fa-ban"></span>';}
else
{return '<span class="fa fa-chain-broken"></span>'; }
},
targets: [6]
},
{ render: function (data, type, row) {
if (data != null && data < today )
{return '<span class="BoldRedColor">' + data + '</span>' }
else
{return '<span>' + data + '</span>';}
},
targets: [5]
},
],
Thanks,
Marc
This discussion has been closed.
Replies
Either of these two will help.
called after each draw done on table
https://datatables.net/reference/option/rowCallback
called only when first created and inserted into table
https://datatables.net/reference/option/createdRow