Few issues with Buttons extension
Few issues with Buttons extension
Hi Alan
Few questions about the buttons extension behaviour.
Im using it like shown below in my initializer, and the buttons are showing just fine. However when i click the CSV button, it downloads a file of type "file", like it doesn't know its supposed to be a csv. I can open it in excel, even though it says that the file is in another format then what the file says. When it does open however, it does not know how to show ÆØÅ.
Another thing is the excel button. When clicked, it downloads a zip file containing few folders containing xml files and other folders. But no actual excel file.
Im using all the scripts listed here: https://datatables.net/extensions/buttons/examples/initialisation/simple.html
In the examples the downloaded files seem to be recognized properly as csv and excel files - do you have suggestions as to what i might do to get the same behaviour?
buttons: [
{
extend: 'excel',
exportOptions: {
columns: [1,2,3,4,5]
}
},
{
extend: 'csv',
exportOptions: {
columns: [1,2,3,4,5]
}
},
]
This question has an accepted answers - jump to answer
Answers
Are you using Safari by any chance?
Allan
No, Chrome latest version - will try in IE and Firefox asap
firefox calls the files "Blob resources" - whatever that is =)
Hmm it doesnt seem to work at all in IE 10. When clicking it says:
Save or open "some hash", but it wont let me download.
Update - after only disabling the jszip.min.js script, it now works with the excel type, but by "falling back" on the flash export :/
csv is still the same.
The excel button not showing on mac safari (all other browsers it works perfectly).
csv and pdf buttons are working fine for me in mac safari.
can you help me to solve this..
Does "colvis" work along with button export options? I like to include that for managing which columns to include in export.
Please advise
@Lijin - Please link to a test case showing the issue.
@rpandey - Yes. Simply include both button types in your buttons array. If it isn't working for you, please link to a test case showing the issue.
Allan
Bump
Can you try the nightly version of Buttons - including the latest version of the HTML5 export buttons file please.
If that doesn't work, please link to a test case showing the issue.
Allan
Hi allan,
It works perfectly with that nightly version. I just changed the Html5 script to nightly and it worked, with ÆØÅ in csv aswell.
Should i be worried about downloading that script and using it? I can see that its for testing only.
Kind regards
Okay, weird issue. It works when i load the script from
https://nightly.datatables.net/buttons/js/buttons.html5.min.js
But not when i copy the file and create my own .js file... I doesnt know how to show ÆØÅ.
Any suggestions?
No - it is stable as far as I am aware.
Regarding the issue - I'm afraid I really don't know without a test case. Perhaps clear your cache?
Allan
Seems like buttons are not showing in Safari, when I look at the following example they appear in Chrome & Firefox, but not Safari Version 8.0.8
http://datatables.net/extensions/buttons/examples/html5/columns.html
I'm also experiencing a problem with Safari when adding the Excel button to my own project, the file doesn't download http://radishlab.github.io/WCC002/
When I removed this scripted it worked with the nightly build: https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js
The
excelHtml5
button will not work in Safari at all - as noted in the button's documentation. This is because of an unimplemented feature in Safari.If it is something you need, use Apple's feedback tools to request that they get around to implementing it (very frustrating that they haven't already!).
Allan
Hi Allan,
My apologies I did not see that in the documentation. However, I did manage to get it to work by using the nightly build of dataTables.buttons, any ideas why it would work now? I have not included the Flash library.
Hi clhenrick,
What type of button are you using at the moment? "excelHtml5" or just "excel".
Im curious since the download happens instantly even with 1700 rows, where as mine seems alot slower (using html5).
Even with the nightly build the Excel button shouldn't work in Safari, so there is something else going on. We'd need a link to the page to fully understand the issue.
Allan
I'm having a problem with exporting as Excel in both Safari and Chrome (both using Flash).
In Safari:
I click the "Export as Excel" button and then a dialog appears, I click save, and the dialog remains. None of dialog buttons works so I have to force quit Safari. The file isn't downloaded.
In Chrome:
I click the "Export as Excel" button and the same dialog appears. I click save, and the file is downloaded. I try to open the file in Apple Numbers and it doesn't work. A colleague who has Excel confirms he couldn't open it in Excel. The file has a size (it takes up space on the hard drive). Further adding to this intrigue is that Google Docs will open the downloaded .XLSX file!
Here's a screencast of what happens in Chrome. I performed this screencast using the nightly builds, but the same problem happens when I use the following CDN-hosted files:
You can see a live version on Chicago Cityscape.
(You may also notice that, additionally, exporting as CSV doesn't work in Safari or Chrome.)
Hi,
I've just tried adding an Excel button to your page (it isn't present at the moment) using:
Then if I click the created button an XLSX file is downloaded and I can open it in Excel no problem.
Can you put the Excel button back into the page so I can try it without my hacky button addition. Also, I presume you have software on your computer that can display xslx files? The icon in your screencast doesn't show it being associated with either Excel or LibreOffice (or anything else).
Allan
@allan: I put the Excel button back.
Safari hangs when you click "save", prevents using other tabs, and the dialog won't go away, and I have to force quit Safari.
In Chrome, the .xlsx file downloads but it won't open in Apple Numbers, Apple's equivalent to Excel.
Hi,
Thanks for putting the button back. I've just tried the page with Safari 8.0.8 and Flash 18. The file downloads and open in Excel and LibreOffice for me no problem. I've also just tried Google Docs and that works okay as well.
Unfortunately I don't have Numbers installed. Does it give any error messages other than "Can't open file"?
Allan
hi Allan,
I have the same issue, my excel button was working fine till I upgraded to El Capitan. I am on safari 9.0.1 and it freezes as soon as I click on save
I checked the page of @stevevance, same issue there.
I think this is only happening on latest safari version.
Please help
I've finally updated my machine to 10.11 and just been testing this out. And I absolutely see the same issue. Debugging unfortunately reveals very little as this occurs in the Flash player, rather than in Javascript. As such I've opened a bug on the Adobe bug tracker and hopefully they will fix this issue.
Even better would be if Apple would fix Safari so we don't need to use Flash :-)
Allan
"Even better would be if Apple would fix Safari so we don't need to use Flash :-)"
+1
Vote here (Webkit bug tracker) and Apple's feedback page for Safari.
Allan
https://datatables.net/extensions/buttons/examples/initialisation/simple.html
Here on this link is there a way to get dialog box popup to save(for buttons).
Thanks.
@suchit - Your question doesn't really appear to be relevant to the original thread, other than the fact that it is about Buttons. Can you, in future, create new threads for new questions.
I'm afraid I don't actually understand you question. Do you mean you want the browser to ask the user where to save the file rather than just immediately downloading it? That unfortunately isn't something I'm able to control, its a browser "feature" for client-side created files.
Allan