Load buttons with ajax
Load buttons with ajax
yvesmex
Posts: 7Questions: 2Answers: 0
I am using your data ajax source (array) example. I 've added to the java script after the "ajax".. line the following line: buttons: ['excel', 'pdf' ]
The buttons do not load.
Could you indicate the correct java script for this example with these buttons?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The ajax option is independent of the buttons option config. I suspect you forgot to add a comma between the two options. Or you haven't added
dom
to the config. See if this config helps:You also need to include the additional JS and CSS for the Buttons extensions and the jszip and pdfmake code.
Take a look at this basic buttons example:
https://datatables.net/extensions/buttons/examples/initialisation/simple.html
Kevin
Kevin,
Thanks for your help.
I reckecked my code and nothing seems to be missing in the head and in the javascript.
In the jacvascript I do:
$("#test_table").dataTable({
ajax: 'gcm_txtreport/sstractos_turnosrep.txt',
dom: 'Bfrtip',
buttons: ['excel', 'pdf'],
language : { ....}
});
When executing the code I get this error in chrome:
Uncaught TypeError: Cannot read property 'version' of undefined
at buttons.flash.min.js:24
at buttons.flash.min.js:1
at buttons.flash.min.js:1
the buttons flash script i am loading is:
same as in the example simple.html
Any ideas?
Yves
Are you loading 'https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js'?
dataTables.buttons.min.js
is to be loaded before the other buttons include files.You may want to read this page to understand the difference between the flash and html5 buttons.
https://datatables.net/extensions/buttons/built-in
Kevin
Kevin,
Working !
The order soved it
Many thanks for your expert help.
Regards
Yves