pdf button not working in DataTables -
i have used datatables in html page. have inserted pdf button save document/table in pdf format.this default feature in datatables.
however, button not working though displayed in html page.
below code :
datatable.html
<html> <link rel="stylesheet" type="text/css" href="datatables-1.10.7/media/css/jquery.datatables.css"> <script type="text/javascript" charset="utf8" src="datatables-1.10.7/media/js/jquery.js"></script> <script type="text/javascript" charset="utf8" src="datatables-1.10.7/media/js/jquery.datatables.js"></script> <script type="text/javascript" charset="utf8" src="datatables-1.10.7/extensions/tabletools/js/datatables.tabletools.js"></script> <link rel="stylesheet" type="text/css" href="datatables-1.10.7/extensions/tabletools/css/datatables.tabletools.css"> <!--<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.7/css/jquery.datatables.css"> <script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.7/js/jquery.datatables.js"></script>--> <body> <table id="example" class="display"> <thead> <tr> <th>first name</th> <th>last name</th> </tr> </thead> </table> <script> $(document).ready( function () { var data = [ [ "tiger nixon", "system architect" ], [ "garrett winters", "accountant" ] ]; $('#example').datatable({ "aadata": data, "dom" : 't<"clear">lfrtip', "tabletools" : { "sswfpath": "datatables-1.10.7/extensions/tabletools/swf/copy_csv_xls_pdf.swf" } }); } ); </script> </body> </html>
what ?
try : add following js , css in following sequence : https://www.datatables.net/release-datatables/media/js/jquery.js https://www.datatables.net/release-datatables/media/js/jquery.datatables.js https://www.datatables.net/release-datatables/extensions/tabletools/js/datatables.tabletools.js https://cdn.datatables.net/1.10.7/css/jquery.datatables.min.css <table id="example" class="display"> <thead> <tr> <th>first name</th> <th>last name</th> </tr> </thead> </table> $(function () { var data = [ [ "tiger nixon", "system architect"], [ "garrett winters", "accountant"] ]; $('#example').datatable( { "aadata": data, "dom": 't<"clear">lfrtip', "tabletools": { "sswfpath": "/swf/copy_csv_xls_pdf.swf" } } ); });
Comments
Post a Comment