Sorting when there is a custom render on the column
Sorting when there is a custom render on the column
I am new to datatables and this issue is driving me nuts :-)
I have a column defined as follows:
{
"width": 125,
"data": "price",
"class": "text-right",
"render": function(data, type, row) {
return '
DKK '+row.price+'
<s><small>DKK</small> '+row.oldprice+'</s>';
}
}
But after defining the custom render of the column the sorting gets messed up and happens wrong.
I have tried to add:
"createdCell": function (td, cellData, rowData, row, col) {
$(td).attr("data-order", row.price);
$(td).attr("data-sort", row.price);
$(td).attr("data-filter", row.price);
$(td).attr("data-search", row.price);
}
but it really doesn't make a difference. The col gets sorted but not correctly.
I have also tried adding a
"type": "num-fmt",
to the col but then nothing happens at all.
Any ideas? What am I missing.
Thomas