How to call TT if I call DT on multiple tables with a class?

How to call TT if I call DT on multiple tables with a class?

hellsinghellsing Posts: 22Questions: 8Answers: 0

I have to call datatables on a class because my page has varying number (cca. 6-30) of tables.

The problem is that TableTools doesn't work with this method. Firebug catches a 404 for the SWF file because DT looks for it at the default location, disregarding my setting. It looks for it at "...localhost/mm/media/swf/..." but you can see my setting in my code.

I also set TT to show 3 buttons only, it does at the first table but from the 2nd one it shows all the 5 available. An none of the instances work at all (inc. the first with the 3 buttons).

Could anyone pls. help me how to initialize TableTools in this situation? This method doesn't work:

$(document).ready(function() {
  $('.ansTable').dataTable({
    'sDom': 'T<"clear">lfrtip',
    'bSort': false,
    'bPaginate': false,
    'oTableTools': {
      'sSwfPath': "js/jQuery.datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
      'aButtons': [{
          'sExtends': 'copy',
          'sButtonText': 'vágólap',
          'mColumns': 'all'},
        {
          'sExtends': 'xls',
          'sButtonText': 'Excel / CSV',
          'mColumns': 'all'},
        {
          'sExtends': 'pdf',
          'sButtonText': 'pdf',
          'mColumns': 'all'},
      ]
    },
  });
});

I use the same code with an ID on a page where I have only one table, and everything works there, so the SWF-location is correct,

My debug code is owelat. Sorry I can't give you access to my demo server nor copy this whole page to jsFiddle.

Answers

This discussion has been closed.