Sort by source data and not by display data
Sort by source data and not by display data
freddyd
Posts: 5Questions: 1Answers: 0
Description of problem:
Description of problem:
I'm loading some data from ajax. What I'm trying to achieve is transform some properties to show them, but order the information based on the original data. I need to clarify that I'm using the ajax option but not the server-side.
Here are my options:
{
processing: true,
searchDelay: 600,
ajax: {
URL: "...",
dataSrc: ""
},
...
}
This is the method I am using to transform the data to show:
columnDefs: [{
"targets": [ 0,1,8,9 ],
"orderable": false,
},{
"targets": 2,
data: "country.code",
render: function(data, type, full, meta){
return <span title='${full.country.name_by_language}'><img src='${full.country.flag_path}'></span>;
},
}]
I also have to clarify that if I use the server-side, it works perfectly and make sorts using the data property
This discussion has been closed.
Answers
Take a look at the Orthogonal Data docs. If I understand correctly you will only want to return the
span
for thedisplay
operation, something like this:Kevin
Thanks. Works as i expected!!