Server Side Processing and Ordering on columns
Server Side Processing and Ordering on columns
I have server side processing set up and my data is displayed correctly using the example on this site. But I'm having problems trying to get some of my data to sort correctly when column ordering is invoked. Before I return my results as json, to datatables, I perform some formatting and calculations. The resulting data is what i send back as JSON and have displayed.
Obviously this breaks column ordering for those columns that are not 'sql' columns. I realize cannot do client side sorting since server side takes care of all of this. Is there a workaround for ordering my custom data?
This question has an accepted answers - jump to answer
Answers
For a back end fix (recommend over a client fix) we would have to know more about your back end. Most data containers have a way of resorting.
For client side, you could use something like dataFilter: function(response) {} in your ajax call to resort the data before DataTable "sees" the data.