Problems with datatables callback on pagination
Problems with datatables callback on pagination
FireFoxII
Posts: 17Questions: 10Answers: 0
I'm implementing switchery into datatable in this way
var table = $('#table').DataTable({
pageLength: 25,
responsive: true,
deferRender: true,
stateSave: false,
info: false,
ordering: false,
dom: 'lTfgt<"float-left"i>p',
ajax: {
"url": "../src/routes.php",
"type": "POST",
"async":true,
"dataType": "json",
"data": function(d) {
d.call = "data-vol";
d.dataform = $('#filtroForm').serialize();
d.market = JSON.stringify($('#jstree_topmarket').jstree("get_selected"));
return d;
}
},
language: {
"url": "assets/js/plugins/dataTables/it_IT.txt"
},
"fnDrawCallback": function() {
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
elems.forEach(function(html) {
var switchery = new Switchery(html, { size: 'small' });
});
}
});
and seems ok
but when I switch to page 2 and then come back to page 1, I have this result
Replacing fnDrawCallback with initComplete seems not working
This discussion has been closed.
Answers
In the switchery docs see the section
Multiple calls
to skip already checkboxes that already have switchery applied. If this doesn't help please build a test case so we can take a look at that is happening.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin