export to excel without prompt

export to excel without prompt

mech2softmech2soft Posts: 4Questions: 2Answers: 0

Hi,
Is there a way to export the datatable results to excel without prompting for download location?
Is it possible to get it exported/saved to default download location set for browser??
Thanks,

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,252Questions: 1Answers: 10,420 Site admin

    Buttons should do that - it does for me any way - Chrome Mac.

    The old TableTools extension doesn't have that option.

    Regards,
    Allan

  • mech2softmech2soft Posts: 4Questions: 2Answers: 0

    Hi allan,
    Thanks for your prompt help. It worked fine.
    Now i noticed that the page length dropdown control is not apprearing. Any clue?
    Here is the sample code

     $('#example').dataTable({
                      dom: 'Bfrtip', "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
                       buttons: [
                             {  extend: 'csvHtml5',                            
                                 text: 'Export to CSV'
                             }
                         ]
                          
          });
    }
    
  • allanallan Posts: 63,252Questions: 1Answers: 10,420 Site admin
    edited December 2015 Answer ✓

    dom: 'Bfrtip',

    The dom parameter doesn't include the l option there, so no, it wouldn't be showing the length menu.

    See also this example if you want it styled like the other buttons.

    Allan

This discussion has been closed.