Server-side processing
Server-side processing
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi, I am a little bit confused with server-side processing. I use PHP and my data is very big so the plan is to load 100 rows data each load, and to click next page is to load 100 more rows. Somehow I also still need to display total data (total records) and when to click last page, is to load last records.
Can anyone give very easy examples to my circumstances. Thank you
This question has an accepted answers - jump to answer
Answers
For server-side processing, enable
serverSide
. The protocol is discussed here. Also see examples here. If you download the DataTables repo, there are examples of the server-side scripts here,You would need to set
pageLength
to be 100, to get the required length. The rest of your requirements, i.e. total record count and load the records, will be done automatically by the server-side PHP scripts.Colin
Hi, thank you for the answer. I have made it and be able to load the table as I requested. However, based on the examples, I only can load the data from one table and cannot load the data with QUERY, for example if I want to use criteria for the loaded data (SELECT... WHERE...). I have further questions:
1) Can I use query in server-side processing? How can I do that?
2) What If I use different language programming (exactly asp classic)? Is it possible?
1) If I understand correctly, you are asking how to do data binding to the WHERE part of the query based on submitted data? You can certainly do that, but how you do it will depend upon what server-side language you are using. How do you normal do data binding for queries?
2) Use any language you want. DataTables' doesn't "care" what the server is running, it just wants to see JSON data in with the parameters indicated in the documentation Colin linked to.
We provide server-side libraries for .NET, PHP and Node.js which support server-side processing, and you are welcome to use them if you want.
Allan