lundi 8 août 2016

Datatbles squaredFour checkbox multidelete feature

I am working on a project, which displays the data through datatables jquery plugin. In the first column of the datatable, I put a checkbox specifically, a bootstrap squaredFour checkbox. So, the first column in all the rows, has the checkbox. The next task is to be able to delete all the rows that are checked. I have a delete button at the top, which gets activated if there is atleast one checked row. Once the user clicks on delete button, he should be able to delete the row.

I do not understand, for some reason, I am not able to select more than one row. Once I check on one checkbox, it is selected and if I try to select other checkbox, the selected checkbox is getting unchecked. All this is happening only for first checkbox. Is this because of bootstrap?

This is the code for the checkbox. I returned it as a table data,

  $('#example').DataTable({
    "processing": true,
        "serverSide": true,
            "sPaginationType": "full_numbers",
           // "ajax": "http://localhost:9080/dataTable/tests/user.php"
                "ajax" : {
                    "url" : "http://localhost:9080/swetha/swetha_gmail_to_bbe/trunk/public/" + "swethasemail/mail-ajax/get-data-table/format/json/",
                    "dataType": "json"
                },
                "columnDefs": [{
                        "targets": 0,
                        "orderable": false,
                        "className": "dt-body-center",
                        "render": function(data, type, full, meta){
                             return '<div class="squaredFour "><input type="checkbox" value="None" id="squaredFour" name="check" /><label for="squaredFour"></label></div>';
                         },

                }],

In the above code it returns a checkbox that is populated in the td field in the datatable. The checkboxes on the user interface

Please suggest me a solution for this. Or if there is any other possibility to implement a checkbox feature on datatable for multi delete, please let me know.




Aucun commentaire:

Enregistrer un commentaire