iCheck works with datatables only on the first page. When I navigate to any other page it shows checkboxes but they don't have iCheck applied. This code helps but doesnt' work 100%.
function turn_on_icheck(checkboxClass)
{
$('input[type=checkbox]').iCheck({
checkboxClass: checkboxClass
});
}
$('.data-table').on('page', function() {
turn_on_icheck();
});
When I go to the 2nd page it shows everything fine now, but if I go back to the page that was previously visited, the checkboxes are not there. It seems to me like it causes an error because there is already an instance of iCheck running there. Is there any way to check if there is one running or not?
Do this (write your code in "drawCallback" function):
...
'drawCallback': function(settings) {
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green'
});
},
...
It solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With