What event to use AFTER the datatable is fully drawn

What event to use AFTER the datatable is fully drawn

faniefanie Posts: 3Questions: 1Answers: 0
edited June 2018 in Free community support


I'm actually searching for an event triggered when the Datatable is fully drawn.

I tried with the 'init.dt' and 'draw.dt' events but nothing...

The draw.dt is triggered after the init.dt, and my datatable is fully visible just some seconds after the trigger of the init.dt


  • colincolin Posts: 3,382Questions: 0Answers: 602

    Hi @fanie ,

    This is similar to another thread I just replied to. Take a look at the example here that I used in that thread. For the init to fire, you need to register the listener before the table is initialised,



  • faniefanie Posts: 3Questions: 1Answers: 0

    thanks for your reply.

    I register it before initialising my table.

    The only solution I have is that:

    .on( 'init.dt', function() {
        //show nothing
        console.log('no access to: ' + $('.dataTables_scroll') );
            //show element
            console.log('access to: ' + $('.dataTables_scroll') );
        }, 0);

    which isn't really academic... and demonstrate there is only milliseconds to wait to have access to the element.

    So I think it may be because of the asynchronous stuff...

  • allanallan Posts: 48,700Questions: 1Answers: 7,082 Site admin

    That looks like it should work: http://live.datatables.net/kolofuqo/1/edit .

    Given that you are using dataTables_scroll I suspect you've removed your initialisation options - perhaps you are using Ajax? Can you link to a page showing the issue please, otherwise I'm afraid we are just guessing.


Sign In or Register to comment.