How do I select all non-rendered checkboxes?
How do I select all non-rendered checkboxes?
MethodDev
Posts: 3Questions: 2Answers: 0
I have a datatable which is generated but I cannot get the non-rendered checkboxes to check.
My table is called "myTable" ( nail on the head there! ) but I cannot get the fnHiddenNodes to work
Here is the code I am trying:
1.
2. <script type="text/javascript">
3. var table = "";
4. var allPages = "";
5. $(document).ready(function ()
6.
7. {
8. table = $('#myTable').DataTable({
9. "dom": '<"top"fl>rt<"bottom"pi><"clear">',
10. stateSave: true
11.
12. /*'<"top"lf>rt<"bottom"p><"clear">'*/
13.
14. });
15. allPages = table.fnGetNodes();
16.
17. } );
18.
19. function selectAllAttys() {
20.
21.
22. $(':checkbox').each(function () {
23. this.checked = true;
24. });
25.
26. $('input[type="checkbox"]', allPages).prop('checked', true);
27.
28. }
29.
30. </script>
This discussion has been closed.
Answers
Found solution:
https://datatables.net/plug-ins/api/fnGetHiddenNodes
Please close topic.
fnHiddenNodes
is legacy. Indeed so isfnGetNodes
(using the code you have above, it will either be throwing an error, or you must be using DataTables 1.9 or earlier).With 1.10 you would use:
or:
Allan