samedi 27 décembre 2014

Datatable "Select all" checkbox checks checkboxes only for few seconds

I'm having an issue with Datatable selecting all checkbox rows. At the top of my table i have a checkbox with the id "select all". Each row of my table has a checkbox which is by default not checked.


This is the code i use to check all row checkboxes:



$('#selectAll').change(function() {
if( $(this).is(':checked') ) {
$('.row-checkbox').prop('checked', true);
} else {
$('.row-checkbox').prop('checked', false);
}
});


My issue is: after clicking on the select all checkbox, the checkboxes of all rows get checked, but only for 2 seconds, and they go back to unchecked. And ofcourse i want to them to stay checked. (page is not being refreshed or anything).


Does anyone know this problem? And/or know how this weird issue can be fixed? Or could point me in the right direction?


Thank you very much!!





Aucun commentaire:

Enregistrer un commentaire