Retrieve table name from dt parameter

Retrieve table name from dt parameter

itajackassitajackass Posts: 162Questions: 48Answers: 3

I've a button inside datatables.
My datatables is generated dinamically with javascript like:

for ( k=0; k<10; k++) {

  var table = "tab_" + k;

 $("#content").append('<table class="display table table-bordered table-striped table-hover" id="'+table+'" style="width:100%;"></table>');

 $('#'+table).DataTable( {
      ...
      ,
      buttons: [
           {
text: 'Retrieve datatable id',
action: function ( e, dt, node, config ) {

    // do something with table id

console.log($(dt));

} 
     }
      ]
 });

}

I've a button to do some action base on table id... but i don't find attribute inside "dt" to di it..

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @itajackass ,

    This is similar to this thread here. Take a look at the example at the end of that thread, that should do it for you too,

    Cheers,

    Colin

This discussion has been closed.