How to use checkbox selectall only current page?

How to use checkbox selectall only current page?

copsychuscopsychus Posts: 20Questions: 5Answers: 0

whenever use checkall ,it always selected checkbox in all pages, how to make it applied only current page? for example: whenever press checkall on page1, all checkboxes in page1 checked, but checkbox in page2 still unchecked , and even i deselect checkbox in page1, page 2 will be unaffected too. i use checkall given by datatables, is there any methods to do this? i already search whole forum but could't find solution at all.

columnDefs: [
                     {
                         width: "8%",
                         orderable: true,
                         targets: 0,
                         checkboxes: {
                             selectRow: true,
                         },

                     },
              ],

Answers

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

    i use checkall given by datatables, is there any methods to do this?

    Actually it looks like you are using the Gyrocde Checkbox Plugin. Based on your description of the checkboxes working only on one page I'm guessing you are using Server Side Processing. You can see in this Gyrocode Server Side Processing example that the same issue occurs.

    You will need to check with the developer of this plugin to see if he has a fix for this.

    Kevin

  • gyrocodegyrocode Posts: 126Questions: 6Answers: 30

    You can set selectAllPages option to false to disable selecting checkboxes from all pages.

    For example:

                  columnDefs: [
                         {
                             width: "8%",
                             orderable: true,
                             targets: 0,
                             checkboxes: {
                                 selectRow: true,
                                 selectAllPages: false
                             },
     
                         },
                  ],
    

    See more articles about jQuery DataTables on gyrocode.com.

This discussion has been closed.