How do I do this in DataTables?
How do I do this in DataTables?

which I am trying to use in conjunction with an extremely large data source (upwards of 1,000,000 records). In my web application, I have an API that can call on this information, we'll just call it mysite.com/ajaxCall. It returns an array in the formatI have built the API to accept a number of URL parameters, including limit and offset (functioning exactly as their SQL commands), and sortAsc and sortDesc accepting column names.
What I want to implement is have Datatables call only the data it needs from /ajaxCall to display immediately. as opposed to calling all data at once and making the application unusable. I've included a mockup of examples of that in action
Answers
You can use server side processing. The linked doc explains the protocol it supports. Maybe you can adapt your API to support the parameters.
Kevin
Hi,
With that many records you are going to want server-side processing which does as you are looking for, request just the data that needs to be displayed for the current DataTables page (i.e. 10 rows).
The way server-side processing works is that DataTables sends a bunch of information to the server to say "I need rows X to Y, with this ... ordering and this ... search". The parameters DataTables sends are documented on the page I linked to above.
If those parameters don't match what your server implements there are two options:
preXhr
orajax.data
to modify the default parameters into the parameters you want to send.In reply DataTables expects JSON with a little extra information about the number of records in the table, etc - which is also documented on that page.
Allan
which I am trying to use in conjunction with an extremely large data source (upwards of 1,000,000 records). In my web application, I have an API that can call on this information, we'll just call it mysite.com/ajaxCall. It returns an array in the formatI have built the API to accept a number of URL parameters, including limit and offset (functioning exactly as their SQL commands), and sortAsc and sortDesc accepting column names.
What I want to implement is have Datatables call only the data it needs from /ajaxCall to display immediately. as opposed to calling all data at once and making the application unusable. I've included a mockup of examples of that in action
For anyone else reading this thread, there were spam links in the reply and no direct response to my comments above.
Allan