How to get every checked checkbox value in DataTable using PHP?
How to get every checked checkbox value in DataTable using PHP?
fmsthird
Posts: 8Questions: 2Answers: 0
Hi, I am trying to get all the values of the selected checkbox in my DataTable table.
Everything seems to be working well until when my table's data is paginated.
When I submit the Form where my DataTable is, only the checked checkbox value in the current page is getting fetched.
May I know how I can get all the value of the checked checkbox across all pages?
Thanks in advance.
This discussion has been closed.
Answers
Do you mean you enabled "serverSide: true"?
If you have Server Side Processing enabled then the only data available in the client is the data on the page being shown. Would you be able to use client side processing by turning of "serverSide: true"?
If you don't have server side processing enabled then please provide more details of what you are doing. A link to your page or a test case will help us understand what you have to offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
hi @kthorngren thanks for noticing this one. Actually I have the same issue with this one https://datatables.net/forums/discussion/comment/97682/
But I'm new to DataTable that's why I don't really understand how to implement the solution. And if possible I want it to be done from PHP, not in Javascript
Also, I'm developing from my local machine.
Here's how I defined my DataTable:
Sorry, I'm not a PHP coder but suspect the problem is the same as discussed in the thread you linked. Good find BTW! If you use the browser's inspector you will find that the only rows in the DOM are the rows displayed on the page. Datatables keeps a data cache with all the data. As mentioned by the developer in the other thread you will need to use Dattaables API's to get the checkboxes of all pages.
Kevin
@kthorngren given the code snippet I have above, what would be the adjustments I need to make? How can I use DataTables API's .. ?
Thanks much
I haven't tried it but did you try the API that the developer posted in the thread you linked to ?
Kevin