The event execution order DataTable.NET

var dataTable = $('#table')
.on( 'processing.dt', function ( e, settings, processing ) {
    $('#loading_overlay').css( 'display', processing ? 'block' : 'none' );
    if (!processing && dataTable  != null) {
        console.log("processing finished.")
    }
})
.on('xhr.dt', function ( e, settings, json, xhr ) {
    console("xhr event: ajax responsed");
    if (json["success"] == true) {

    }
})
.on( 'page.dt', function () {
    console("paging processed.");
})
.on( 'draw.dt', function () {
    console("draw processed.");
})
.on( 'init.dt', function () {
    console("init processed.");
})
.on( 'click', 'tbody td', function () {
})
.DataTable({ 
     // settings....
});

When the page first load

processing.dt (processing == false) => xhr.dt => page.dt => draw.dt => init.dt => processing.dt (processing == true)

When switched to another one

processing.dt (processing == false) => xhr.dt => page.dt => draw.dt => processing.dt (processing == true)

Guess you like

Origin www.cnblogs.com/sipher/p/11267534.html