newday
newday

Reputation: 3878

hiding a spinner when the data table is loaded

I have a spinner which I need to hide when the data table is loaded.

Here is the code.

$('#datatable').dataTable({
            "paging" : true,
            "scrollX": true,
 "initComplete": function(settings, json) {
                $("#event-buble").css({"display" : "none", "height":"0px", "padding-top":"0px"});
                alert( 'DataTables has finished its initialisation.' );
             },
});

However, though I ran the code, spinner doesn't disappear.both table and spinner are showing.

How to fix this issue?

Upvotes: 1

Views: 3141

Answers (1)

Tristan Lee
Tristan Lee

Reputation: 1220

Try adding a listener to your table for the draw event:

$('#datatable')
    // init the datatable
    .dataTable({
        "paging" : true,
        "scrollX": true,
    })

    // listen for the draw event
    .on( 'draw.dt', function () {
        $("#bubble").hide();
    });

Upvotes: 3

Related Questions