javascript - jQuery Datatables buttons showing as links.. not buttons -


using jquery datatables 1.10.15 , trying use file export options.

here how scripts loaded on page:

<script src="/scripts/datatables/jquery.datatables.js"></script> <script src="/scripts/datatables/datatables.bootstrap.js"></script> <script src="/scripts/datatables/datatables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script> <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script> <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script> 

here datatable setup:

var table = $('#newtable').datatable({     dom: 'bfrtip',     buttons: [ 'excel', 'pdf' ],     'aocolumndefs': [         { "bsortable": false, "atargets": [2, 7] },         { "bsearchable": false, "atargets": [7] }     ] }); 

here how appear:

enter image description here

how them appear buttons , not links?

you're missing proper css file.

try adding css link (from cdn) header.

https://cdn.datatables.net/buttons/1.3.1/css/buttons.datatables.min.css 

working example:

var table = $('#newtable').datatable({      dom: 'bfrtip',      buttons: [ 'excel', 'pdf' ],      'aocolumndefs': [          { "bsortable": false, "atargets": [2, 7] },          { "bsearchable": false, "atargets": [7] }      ]  });
<link href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.datatables.min.css" rel="stylesheet"/>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <script src="https://cdn.datatables.net/1.10.15/js/jquery.datatables.min.js"></script>  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>  <script src="https://cdn.datatables.net/buttons/1.3.1/js/datatables.buttons.min.js"></script>  <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>  <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script>  <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script>  <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>  <script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>  <table id="newtable"></table>


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -