Check All Rows Paginated/Filtered And Submit
Check All Rows Paginated/Filtered And Submit

I've been struggling with this, and I've made progress so far, but I've hit a roadblock:
I've managed to set up a DataTable with a checkbox for every row, and a "Select All" checkbox that when clicked, will select all the checkboxes even across paginated/filtered pages - the problem I'm having is while the form will submit all selected checkboxes (NOT filtered) even across pagination, it won't if the results are filtered. It WILL submit only selected checkboxes (even with or without filtering) just fine.
The other odd behavior is when I hit submit, all the checkboxes pop up for a moment (checked and unchecked) by themselves at the bottom of the DataTable. I'd also like to incorporate validation, but since I'm hijacking the form submit, I've had problems with that as well (although that's beyond the scope of this issue).
I feel like I am really close to solving this common problem, and any help/advice is appreciated. Once I get it working, I'll do a full "how-to" write up afterwards so the rest of the community can benefit!
Here's my DataTables Live example: http://live.datatables.net/lomelono/1/
Thanks!
Answers
Hi Joyrex,
Not entirely sure what exact problem you are asking help for but changing the event handler as follows will at least show the selection:
Each event handler always has an event parameter passed in, so you can use that to stop it from processing/propagating. The result is that the form is not being submitted, since we trapped the event from bubbling up.
Hope this helps,
@Ashbjorn: Unfortunately, no - let me try and explain the problem a bit better:
The check all button WORKS, and will select all rows (with pagination), and will submit them successfully.
When the rows are filtered, the check all button WORKS, but, when submitted, ALL the rows (including ones that were filtered out) get submitted. The goal here is to ONLY pass the filtered rows.
Hopefully that clarifies things and will help in working towards a solution.
UPDATE: Doing some more debugging server-side, it turns out the check all button IS passing only the filtered fields. So, as far as that part of the problem is concerned, that's solved.
What still lingers is how to incorporate jQuery Validate (so if someone does not choose any checkboxes or hits the check all checkbox, it stops client-side), but that's outside the scope of this question - as soon as I solve that, I'll come back a do a full write up of how to do this, since I am sure many have struggled with this as I have!