Server-side sorting broken after column reordering
Server-side sorting broken after column reordering
I seem to be having the same problem as here:
http://datatables.net/forums/discussion/comment/27660
I know that the key to my answer lies here:
[quote]If you have a look in "examples/server_side/scripts/objects.php" you'll see how the server-side processing script works (PHP obviously, but hopefully it will be relatively easy to do in ASP). I had forgotten that it was using mDataProp actually - which is much more preferable then sName in this case (makes life much cleaner on the client-side).
With the information at the server, you just need to convert from the column index that DataTables sends to the array of mDataProp options that DataTables also sends. In that way you know what column name to sort the DB on :-)
Allan[/quote]
However the link to the examples/server_side/scripts/objects.php is currently giving me a 404
Is there an updated link?
Best,
Drew
http://datatables.net/forums/discussion/comment/27660
I know that the key to my answer lies here:
[quote]If you have a look in "examples/server_side/scripts/objects.php" you'll see how the server-side processing script works (PHP obviously, but hopefully it will be relatively easy to do in ASP). I had forgotten that it was using mDataProp actually - which is much more preferable then sName in this case (makes life much cleaner on the client-side).
With the information at the server, you just need to convert from the column index that DataTables sends to the array of mDataProp options that DataTables also sends. In that way you know what column name to sort the DB on :-)
Allan[/quote]
However the link to the examples/server_side/scripts/objects.php is currently giving me a 404
Is there an updated link?
Best,
Drew
This discussion has been closed.
Replies
Here's the updated link - http://datatables.net/release-datatables/examples/server_side/object_data.html
The objects.php script is available here: https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/objects.php .
Basically the thing to do is convert from the column index that DataTables submits to the position in the array that you define the columns in (normally that isn't an issue since you can just make the columns on the client-side match the columns on the server-side!).
Are you okay taking the script from there?
One thing it might be worth saying is that I've updated the PHP scripts for server-side processing for v1.10 which has better modularity and extensibility. For example this is the objects.php script that is used in 1.10: https://github.com/DataTables/DataTables/blob/1_10_wip/examples/server_side/scripts/objects.php (although note that 1.10 by default submits different server-side processing variables with using the new `ajax` option and the new script reflects that!).
Allan
Thanks a lot I think that's good for now. Looks like another week or so before I will get around to implementing the feature. I'll let you know how it goes!