Excel button doesnot work when used in collection, while works fine alone.

Excel button doesnot work when used in collection, while works fine alone.

pesce11pesce11 Posts: 8Questions: 2Answers: 0

works fine


{
extend: 'excel',
text: '<i class="fa fa-file-excel-o"></i> Excel',
titleAttr: 'Excel',
exportOptions: {
columns: ':visible'
},
key: {// keyboard shortcut not working for as well
key: 'l',
altkey: true
}
}


not working in collection


{
extend: 'collection',
text: 'Document',
autoClose: true,
buttons: [
{
extend: 'print',
text: '<i class="fa fa-print"></i> Print',
titleAttr: 'Print Alt+P',
exportOptions: {
columns: ':visible'
},
key: {
key: 'p',
altkey: true
},
//autoPrint: false //not useful
},
{
extend: 'excel',
text: '<i class="fa fa-file-excel-o"></i> Excel',
titleAttr: 'Excel',
exportOptions: {
columns: ':visible'
},
key: {// keyboard shortcut not working for it
key: 'l',
altkey: true
}
}
]
}


hope someone has the same issue been solved

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,351Questions: 1Answers: 10,443 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • pesce11pesce11 Posts: 8Questions: 2Answers: 0
    edited November 2016

    Okay let me share a direct link:
    http://5.157.96.119:10088/dttest/dttest.html

    in the test link there are two excel buttons (one inside collection; doesnt work) while the other works fine.

    [In chrome shows:] pepflashplayer.dll: 0x94E is not a valid resource ID.

  • allanallan Posts: 63,351Questions: 1Answers: 10,443 Site admin

    Could you remove this line please:

    <script src="//cdn.datatables.net/buttons/1.2.1/js/buttons.flash.min.js"></script>
    

    The Flash buttons are already being included from the CDN. Indeed, Unless you really need Flash support, I would recommend removing the b-flash-1.2.2 part of the URL.

    I don't immediately see why the Flash player is crashing, but Flash player is not known for its stability at the moment...

    Allan

  • pesce11pesce11 Posts: 8Questions: 2Answers: 0
    edited November 2016

    Thanks for the suggestion,

    I have removed both the b-flash-1.2.2 from the URL and also removed:
    cdn.datatables.net/buttons/1.2.1/js/buttons.flash.min.js line.

    http://5.157.96.119:10088/dttest/dttest.html

    Now the problem is both the excel buttons are disappeared.

  • allanallan Posts: 63,351Questions: 1Answers: 10,443 Site admin
    Answer ✓

    Got it! I've realised now why the HTML5 Excel export button wasn't showing - the JSZip dependency hasn't been included. You need to include JSZip to allow a valid Excel file to be created (its technically just a zip of directories and XML files). Without that dependency the Excel HTML5 button won't show.

    Allan

  • pesce11pesce11 Posts: 8Questions: 2Answers: 0

    Thanks you very much Allan.
    Problem solved

This discussion has been closed.