Sorting with data-order attribute on ajax sourced data ?
Sorting with data-order attribute on ajax sourced data ?

I have a dataTable that is rendered based on a AJAX Sourced data. Here is my render function...
'data': 'properties.taxon_id',
render: function(data) {
if(data != null)
{
for(var i = 0; i < spData.length; i++) {
if (spData[i].taxon_id == data) {
console.log(spData[i].model_mean);
var result = "<b>Some text</b>" + spData[i].model_mean + '<span class="glyphicon glyphicon-download-alt" onClick="downloadFile\(this\.id\)" ></span>';
//var result = (spData[i].model_mean);
}
}
return result
}
else {
return null
}
}
Then I have a columnDefs function which I use to provide the data-order attribute to the cell.
columnDefs: [
{
targets: 3,
data: {
_: "num-fmt@data-order",
sort: "num-fmt@data-order",
type: "num-fmt@data-order"
}
}]
The data in this cell is decimal data with some text and a HTML tag around it. Unfortunately, this is not sorting as per the data-order attribute. Can someone help me with this?
This discussion has been closed.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin