TableTools fails on datatables initialized on classes

TableTools fails on datatables initialized on classes

hellsinghellsing Posts: 15Questions: 5Answers: 0
edited June 2014 in Free community support

Hey Guys,

I have a page that has varying number of tables, that's why I initialize datatables (DT) on a class instead of unique IDs. All lights are green until I want to use TableTools (TT).

Nothing happens when I click any TT button. The only error message I can catch is this:

"NetworkError: 404 Not Found - http://localhost/mm/media/swf/copy_csv_xls_pdf.swf"

This is strange because I properly defined the location of the SWF file and this is not "...localhost/mm/media/swf/..." but "js/jQuery.datatables/extras/TableTools/media/swf/..." (see the code bleow). On my other pages (where I have only one table so I can call DT and TT on an ID) TableTools loads and works from that location w/o any problem.

Beyond that I want to use 3 buttons only: copy, Excel and pdf with translated text on them. At the first table, everything looks good. At the rest of the tables I see all the 5 available buttons (the 3 of mine + CSV, Print) in English and I can't use them at all at any table (inc. the first one).

$(document).ready(function() {
  $('table.ansTable').dataTable({
    'sDom': 'T<"clear">lfrtip',
    'bSort': false,
    'stateSave': true,
    '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'},
      ]
    },
  });
});

It seems to be that TT can not be used with DT initiaIised on multiple tables with the use of a class instead of separate IDs but Icouldn't find any reference about it. Alas I couldn't find out a better solution for this page as it contains 4 to 20+ tables (result matrices of questonaries with varying number of questions).

Could you pls. help me how to use TableTools in this situation?

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

Answers

  • hellsinghellsing Posts: 15Questions: 5Answers: 0

    Can anyone help me how to use TableTools when I have to initialise Datatables on classes instead of IDs?

This discussion has been closed.