Problems with datatables callback on pagination

Problems with datatables callback on pagination

FireFoxIIFireFoxII 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

enter image description here

but when I switch to page 2 and then come back to page 1, I have this result

enter image description here

Replacing fnDrawCallback with initComplete seems not working

enter image description here

Answers

This discussion has been closed.