Govind Sharma
Govind Sharma

Reputation: 9

Why DataTable TableTools export to pdf or excel or csv button are not visible only print button is visible?

I have created the datatable with tabletools but I'm not able to view all the buttons like export to pdf or excel or copy or csv only print button is visible.

Here is my code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.js"></script>
<script src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
<script src="//cdn.datatables.net/tabletools/2.2.4/js/dataTables.tableTools.min.js"></script>

$(document).ready(function()
    {
        var table = $('#datatable').dataTable();
        var tableTools = new $.fn.dataTable.TableTools(table, {
            "aButtons" : [ "copy", "csv","copy", "pdf", "print" ],            
            'sSwfPath': '//cdn.datatables.net/tabletools/2.2.4/swf/copy_csv_xls_pdf.swf'
        });
        $(tableTools.fnContainer()).insertBefore('#datatable_wrapper');
    });

My output is ::

enter image description here

Here I need all the option for exporting.

plz help.

Upvotes: 0

Views: 2513

Answers (2)

user1687805
user1687805

Reputation: 1

Use below code :

buttons: [
  {
    extend: 'excelHtml5',
    title: 'Interview' ,
    exportOptions: {
      columns: [1,2,3,4,5]
      }
  },
  {
    extend: 'pdfHtml5'  ,
    title: 'Interview' ,
    exportOptions: {
      columns: [1,2,3,4,5]
      }
  },
  {
    extend: 'copy' ,
    exportOptions: {
      columns: [1,2,3,4,5]
      }
  },
  {
    extend: 'print' ,
    exportOptions: {
      columns: [1,2,3,4,5]
      }
  } 
],

Upvotes: 0

Preia Motheeram
Preia Motheeram

Reputation: 41

I had the same problem with Chrome.

Enabling flash worked for me. Click on the "View site information" icon on the left hand side of the URL, then always allow flash for the specific site. Or go to chrome://settings/content/flash and disable "Ask first".

Upvotes: 4

Related Questions