dimanche 26 mai 2019

Datatables Checkboxes select multiple on matching ids

I have a server-side datatable setup with the checkboxes plugin. Each checkbox has the data of a product_id.

var table = $('#display_users').DataTable( {
        "processing": true,
        "serverSide": true,
        'ajax': '',
        'columns' : [
            {"data" : "product_id"},
            {"data" : "product_id"},
            {"data" : "first_name"},
            {"data" : "last_name"},
            {"data" : "email"},
            {"data" : "company"},
            {"data" : "department"},
            {"data" : "created_at"}
        ],
        'columnDefs': [
            {
                'targets': 0,
                'checkboxes': {
                    'selectRow': true
                },

I would like to be able to, when a checkbox is selected, select all the checkboxes with the same product_id. This is only necessary for the records on the currently selected page. It seems this should be possible with the checkboxes select api, however I haven't been successful so far




Aucun commentaire:

Enregistrer un commentaire