Global initComplete handler

Global initComplete handler

YaniYani Posts: 24Questions: 7Answers: 0

I have multiple datatable instances which all load a plugin within their initComplete function. Is it possible to define a global initComplete handler so I don't have to do this anymore?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,338Questions: 1Answers: 10,228 Site admin
    Answer ✓

    Hi,

    Sorry for the delay in replying here.

    Yes this is possible using the init event:

    $('body').on( 'init.dt', function ( e, ctx ) {
      var api = new $.fn.dataTable.Api( ctx );
    
      ... do something with the DataTables API.
    } );
    

    Regards,
    Allan

  • YaniYani Posts: 24Questions: 7Answers: 0

    Thanks a lot Allan! :)

This discussion has been closed.