Home » Php » php – jquery datatable initComplete function not working

php – jquery datatable initComplete function not working

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am using the jQuery DataTable. I have a initComplete function which doesn’t work when you move to the next page. However on the first page, it does work and whatever I have inside the initComplete does get fired.

let table = $('#customer_data').DataTable({
        processing: true,
        serverSide: true,
        serverMethod: 'post',
        ajax:{
            type:'POST',
            url: "search",
            data: postData
        },
        columns: [
            {
                data:'name',
                name:'name'
            }
        ],
        columnDefs: [
            {
                targets: [0],
                className: "text-center",
            }
        ],
        initComplete: function (settings, json) {
            console.log(settings);
        }
    });
How to&Answers: