Search code examples
javascriptjquerydatatablestabletools

Issue with tabletool of datatable with pdf, csv, xls and copy options


sTable = $('#s').dataTable({
        "bVisible":"True",
        "dom": 'T<"clear">lfrtip',        
        "tableTools": {           
            "sSwfPath": "https://cdn.datatables.net/tabletools/2.1.1/swf/copy_csv_xls_pdf.swf",            
            "aButtons": [ 
               "copy", 
               "csv", 
               "xls",            
               "pdf",
               "print",
               "select_all", 
               "select_none" 
            ]
        }
});

Buttons are showing fine, but copy,csv,xls,pdf are not working, i am not getting any 404 , i have checked in browser console, but i am loading total datatable and buttons 's container dynamically with a filter button. it may cause problem,, please help me .


Solution

  • Finally i got the solution, and it is working fine.. The problem was that my buttons are in hidden, so while intialisation time it was not getting the height and widht of my tabletool button's. So i created a function on call back funtion which add the width and height of the buttons.

    funtion m(){
      $('[id^=ToolTables_] embed').each(function( index ) {
      $(this).attr('width','47px');
      $(this).attr('height','47px');       
      });
      }