Search code examples
jquerydatatablestabletools

jQuery TableTools buttons not loading


I am trying to add tableTools to an existing table that already uses the DataTable plug in. The tableTools buttons do not load. This is my code:

var dataTableOptions = {
  "sScrollY":   "475px",
  "bAutoWidth": true,
  "bSort":      true,
  "bPaginate":  true,
  "sPaginationType": "full_numbers",
  "bFilter":    true,
  "bInfo":      true,
  "bJQueryUI":  true,
  "sDom": '<"clear">lfrtip',
  "oTableTools": {"sSwfPath": appPath + "/swf/copy_csv_xls_pdf.swf"}
};

$j("#movementsResults table").dataTable(dataTableOptions);

The dataTable part works fully, but tableTools don't seem to be working. I have ensured all file paths are correct, including the .swf path and I just can't find the problem.


Solution

  • After running developer tools I got an error:

    SCRIPT5009: 'ZeroClipboard_TableTools' is undefined TableTools.js, line 1293 character 3

    After googling to find out exactly what ZeroClipboard was, I found out I needed to include that JS file separately, as it was trying to call a function that was created in there. After doing so the buttons started to work, just a matter of styling them now.

    Thanks for the help guys