The initComplete is not being called after a ajax.reload(). I am working on a C# MVC project

The initComplete is not being called after a ajax.reload(). I am working on a C# MVC project

ursg004ursg004 Posts: 1Questions: 1Answers: 0

The initComplete is not being called after a ajax.reload(). I am working on a C# MVC project

oXwalkData = $('#xwalkTable').DataTable({
    scrollCollapse: true,
    scrollY: "700px",
    bFilter: false,
    bLengthChange: false,
    paging: true,
    info: false,
    "ajax": {
        "url": "/QSIHedisWebApp/ProviderSpecialtyXwalk/GetXwalkData",
        "type": "GET",
        "datatype": "json",
        "data": function (d) {
            d.plan = $('#SelectedPlan').val()
        }
    },
    initComplete: function () {
        this.api().columns().every(function () {
            var column = this;
            var select = $('<select><option value=""></option></select>')
                .appendTo($(column.header()).empty())
                .on('change', function () {
                    var val = $.fn.dataTable.util.escapeRegex(
                        $(this).val()
                    );

                    column
                        .search(val ? '^' + val + '$' : '', true, false)
                        .draw();
                });

            column.data().unique().sort().each(function (d, j) {
                select.append('<option value="' + d + '">' + d + '</option>')
            });
        });
    },
    "columns": [
            { "data": "Plan", "autoWidth": true, className: "dt-body-center", "bSortable": false },
            { "data": "Description", "autoWidth": true, className: "dt-body-center" },
            { "data": "Specialty", "autoWidth": true, className: "dt-body-center" },
            { "data": "RX", "autoWidth": true, className: "dt-body-center" },
            { "data": "PCP", "autoWidth": true, className: "dt-body-center" },
            { "data": "ExcludeMBR", "autoWidth": true, className: "dt-body-center" },
            { "data": "Specialty1", "autoWidth": true, className: "dt-body-center" },
            { "data": "Specialty2", "autoWidth": true, className: "dt-body-center" },
            { "data": "Specialty3", "autoWidth": true, className: "dt-body-center" },
            { "data": "AuditorApproved", "autoWidth": true, className: "dt-body-center" },
                {
                    "mDataProp": function (source, type, val) {
                        return '<a class="noColorLink" href="/QSIHedisWebApp/ProviderSpecialtyXwalk/Edit/?id=' + source.ProviderSpecialtyId + '">Edit</a>'
                    }, "bSortable": false, "orderable": false
                },
            { "data": "ProviderSpecialtyId", "visible": false },
    ]

});
This discussion has been closed.