"Unchangeable" server API
"Unchangeable" server API
Hi everyone,
For a while I've been using a modified version of Piston[1] and used it to render all (data)tables using server-side processing[2]. I've been forced to switch to another API however, because Piston reached EOL. TastyPie[3] seemed like a good alternative, considering its userbase, features and flexibility.
Since it supports many of the datatables options by default, I want to use them, preferably without changing any Python code. Can I change, for example, the option 'iDisplayStart' to 'offset' and 'iDisplayLength' to 'limit'?
Thanks,
Martijn
[1] https://bitbucket.org/jespern/django-piston/wiki/Home
[2] http://datatables.net/usage/server-side
[3] https://bitbucket.org/dc/django-tastypie/overview
Btw: @allan: I donated a small amount :-). Thanks for creating this excellent piece of software.
For a while I've been using a modified version of Piston[1] and used it to render all (data)tables using server-side processing[2]. I've been forced to switch to another API however, because Piston reached EOL. TastyPie[3] seemed like a good alternative, considering its userbase, features and flexibility.
Since it supports many of the datatables options by default, I want to use them, preferably without changing any Python code. Can I change, for example, the option 'iDisplayStart' to 'offset' and 'iDisplayLength' to 'limit'?
Thanks,
Martijn
[1] https://bitbucket.org/jespern/django-piston/wiki/Home
[2] http://datatables.net/usage/server-side
[3] https://bitbucket.org/dc/django-tastypie/overview
Btw: @allan: I donated a small amount :-). Thanks for creating this excellent piece of software.
This discussion has been closed.
Replies
DataTables core expects those parameters and they are not currently configurable - however there is one option which is reasonably simple to implement. What you can do is use fnServerData - with this function you would send your own Ajax request to the server (rather than just having DataTables do its internal one) and then when the data comes back, map that 'offset' (etc) to the parameters that DataTables needs (i.e. json.iDisplayStart = json.offset; ). That would allow both the server and DataTables to be unchanged.
> Btw: @allan: I donated a small amount :-). Thanks for creating this excellent piece of software.
Thank you very much for your kind words and the donation :-)
Regards,
Allan