Answers for "datatables and toggle not working"

0

datatable dropdown toggle not working

$('#payment-notcompleted-table').DataTable().ajax.reload( function() {
  // initialize dropdown
  $('.dropdown-toggle').dropdown();
});
Posted by: Guest on August-04-2020
0

datatables and toggle not working

CAUSE
Pages other than first do not exist in DOM at the time of initialization, that is why your handler never gets called.

SOLUTION
You need to use event delegation by providing selector as a second argument in on() call, see example below:
$(document).ready(function(){
    $('#table_name').DataTable();

    $('#table_name').on('click', '.some-toggle-class', function(){
        // your code here
    });   
});
Posted by: Guest on March-22-2021

Code answers related to "datatables and toggle not working"

Code answers related to "Javascript"

Browse Popular Code Answers by Language