Few issues with Buttons extension

Few issues with Buttons extension

AndersHPAndersHP Posts: 36Questions: 14Answers: 1

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

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Are you using Safari by any chance?

    Allan

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    No, Chrome latest version - will try in IE and Firefox asap

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    firefox calls the files "Blob resources" - whatever that is =)

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    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.

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    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.

  • LijinLijin Posts: 3Questions: 0Answers: 0

    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..

  • rpandeyrpandey Posts: 4Questions: 1Answers: 0

    Does "colvis" work along with button export options? I like to include that for managing which columns to include in export.

    Please advise

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    @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

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    Bump

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    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

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    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?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Should i be worried about downloading that script and using it? I can see that its for testing only.

    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

  • clhenrickclhenrick Posts: 5Questions: 1Answers: 0
    edited September 2015

    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/

  • clhenrickclhenrick Posts: 5Questions: 1Answers: 0

    When I removed this scripted it worked with the nightly build: https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I'm also experiencing a problem with Safari when adding the Excel button to my own project

    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

  • clhenrickclhenrick Posts: 5Questions: 1Answers: 0
    edited September 2015

    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.

  • AndersHPAndersHP Posts: 36Questions: 14Answers: 1

    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).

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • stevevancestevevance Posts: 58Questions: 6Answers: 1
    edited October 2015

    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:

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/bs/jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-colvis-1.0.3,b-flash-1.0.3,b-html5-1.0.3,b-print-1.0.3,r-1.0.7/datatables.min.css"/>
    <script type="text/javascript" src="https://cdn.datatables.net/r/bs/jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,b-1.0.3,b-colvis-1.0.3,b-flash-1.0.3,b-html5-1.0.3,b-print-1.0.3,r-1.0.7/datatables.min.js"></script>
    

    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.)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    I've just tried adding an Excel button to your page (it isn't present at the moment) using:

    var b = new $.fn.dataTable.Buttons( '#permits_communityarea-rogers-park', {buttons: ['excel']} );
    $('body').append(b.container());
    

    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

  • stevevancestevevance Posts: 58Questions: 6Answers: 1

    @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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • technoproverbstechnoproverbs Posts: 2Questions: 0Answers: 0
    edited October 2015

    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

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • stevevancestevevance Posts: 58Questions: 6Answers: 1

    "Even better would be if Apple would fix Safari so we don't need to use Flash :-)"
    +1

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
  • suchitsuchit Posts: 1Questions: 0Answers: 0

    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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    @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

This discussion has been closed.