I want to remember the marked checkboxes in my dataTable. currently it works when I checked individual check boxes. How to do same with toggle checkbox ? please advice
view
<th><input name="select_all" class="groupCheckBoxAll" type="checkbox"/></th>
<td><input type="checkbox" class="groupCheckBox" name="emails[]" value=' + id + ' ></td>
js
here is my datatable rowcallback function
"rowCallback": function(row, data, dataIndex) {
var rowId = data['id'];
if ($.inArray(rowId, checkedArray) !== -1) {
$(row).find('input[type="checkbox"]').prop('checked', true);
}
}
$(document).on('change','.groupCheckBox',function(){
if ($(this).is(':checked')) {
checkedArray.push($(this).val());
} else {
var index = checkedArray.indexOf($(this).val());
if (index >= 0) {
checkedArray.splice(index, 1);
}
}
});
pls advice
Aucun commentaire:
Enregistrer un commentaire