Upgrade to Buttons 1.2.1 loses Excel and PDF button
Upgrade to Buttons 1.2.1 loses Excel and PDF button
Hi,
We updated a project we are currently developing from Datatables 1.10.07 to 1.10.12 and buttons 1.1.2 to buttons 1.2.1.
The excel and pdf buttons we had on the bottom of our tables disappeared. The other buttons (csv, copy & print) are still there and function OK.
The init for the excel button is: -
buttons: [
{
extend: 'excelHtml5',
title: 'Client Portal Compliance List',
exportOptions: { columns: [0,1,2] },
sheetName: 'Job List'
}
]
So there is no reason we can see why this is the case. For now we have had to go back to Buttons 1.1.2.
Any ideas as to why they no longer appear?
This question has an accepted answers - jump to answer
Answers
Can you link to the page showing the issue please? I can only guess that the page isn't including the dependencies, since as you can see from this example the buttons should work.
Allan
Thanks for the reply Allan, but the site is not public.
However I can give you as much code as I can. There are no issues (404) with any links.
I'm currently still experimenting with you're live site so you may want to hold off looking at the above code until I've finished
Hi Allan,
You will be glad to know I've managed to sort the problem out. It seems the new versions are much pickier on the order of the dependencies.
Moving the javascript references of "buttons.html5.min.js" and "buttons.print.min.js" to the bottom of the list sorted the problem.
Couldn't help but notice that there are still a lot of references to a very old version of jQuery in your examples and the live site. Is there a reason for that?
Thanks for the updates. Yes, I was just looking through the code and spotted the ordering as well.
The reason for this order dependency now is that Buttons provides the option for the CommonJS loader to pass in previously loaded dependencies. So Buttons, at that point, takes the value of the global variables if they weren't passed in. Thus before they were holding
undefined
. Using a function might be an option to solve this if it trips more people up.The examples use jQuery 1.12.3 which is just one behind the current 1.12.4 release (for the 1.x branch). The live site could definitely do with being updated.
I use jQuery 1.x in the examples for compatibility with older browsers.
Allan