Excel option button missing with Safari using a mac

Excel option button missing with Safari using a mac

eddie909eddie909 Posts: 31Questions: 6Answers: 0

I have everything working in every browser except when using Safari on a mac. Below is my code:

`$(document).ready(function() {

            var courseInformation = $('#courseInformation').val();

        $('table.display').DataTable( {
            "lengthMenu": [ [25,50,75,100, 250, -1], [25,50,75,100,250, "All"] ],
            "ordering": false,
            dom: 'Blfrtip',
            buttons: [
                      {
                          extend: 'excelHtml5',
                          text: 'Save as Excel',
                          filename: courseInformation,
                          customize: function( xlsx ) {
                              var sheet = xlsx.xl.worksheets['sheet1.xml'];
                              $('row:first c', sheet).attr( 's', '37' );
                              $('row:nth-child(3) c', sheet).attr( 's', '32' );
                          }
                      },
                      {
                          extend: 'csvHtml5',
                          fieldBoundary: '',
                          filename: courseInformation,
                          text: 'Save as Csv',
                        },
                        {
                            extend: 'pdfHtml5',
                            orientation: 'landscape',
                            pageSize: 'LEGAL',
                           filename: courseInformation,
                           text: 'Save as Pdf',
                            exportOptions: {
                                columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
                            }
                        }
                  ]
                } );

            } );`

Do you have any suggestions?

thanks,
- Ed

Answers

  • eddie909eddie909 Posts: 31Questions: 6Answers: 0

    On the HTML5 export buttons page, the Excel button also doesn't display in Safari.

    https://datatables.net/extensions/buttons/examples/html5/simple.html

    • Ed
  • allanallan Posts: 63,208Questions: 1Answers: 10,415 Site admin

    As noted in the excelHtml5 button documentation:

    Safari does not currently support the ability to download generated files (see WebKit bug 156056). As soon as this has been addressed in Safari it will be released here.

    I'm subscribed to the various Webkit bugs about this and there has been some activity in this area, so I'm hoping it is something they will address soon.

    Regards,
    Allan

  • allanallan Posts: 63,208Questions: 1Answers: 10,415 Site admin

    If you would like to see this addressed submit feedback to Apple - it is very frustrating that Safari doesn't support this feature.

    Makes one almost wish for Flash... (not really).

    Allan

  • eddie909eddie909 Posts: 31Questions: 6Answers: 0

    Thanks for getting back to me.

    I got it to work in Safari by using :

    { extend: 'excel', text: 'Save as Excel', filename: courseInformation, customize: function( xlsx ) { var sheet = xlsx.xl.worksheets['sheet1.xml']; $('row:first c', sheet).attr( 's', '37' ); $('row:nth-child(3) c', sheet).attr( 's', '32' ); }

    thanks,
    - Ed

  • eddie909eddie909 Posts: 31Questions: 6Answers: 0

    I thought I got it to work (the excel button now appears in Safari) but the excel doc contains unreadable contents.

  • allanallan Posts: 63,208Questions: 1Answers: 10,415 Site admin

    I think it would require more than that to work in Safari. As I say, it doesn't (as far as I am aware) support the APIs required to download the created file. The Webkit bug noted above and in the documentation states that it is still open.

    Allan

This discussion has been closed.