Sorting when there is a custom render on the column
Sorting when there is a custom render on the column
![kjaer](https://secure.gravatar.com/avatar/bde8b41ad82e1be7bfa0c61beea27846/?default=https%3A%2F%2Fvanillicon.com%2Fbde8b41ad82e1be7bfa0c61beea27846_200.png&rating=g&size=120)
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