Unable to export the table as excel file

Unable to export the table as excel file

lsharsharaolsharsharao Posts: 3Questions: 1Answers: 0

Hi,

I am using the latest stable version of data tables and table tools for my project. The UI is appearing as expected, also the pagination and search functionality is working too. However when I click the excel button no action is performed. I see no error on my browser console.

I have initialised the table as follows

$(document).ready(function(){
    $('#user_table').DataTable( {
        "dom": 'T<"clear">lfrtip',
        "tableTools": {
            "sSwfPath": "js/swf/copy_csv_xls.swf"
        }
    } );
});

This is first time I am using this plugin so I am unsure as to where the problem might be.

Kindly help.

Thanks

Answers

  • atcclearsatcclears Posts: 24Questions: 7Answers: 0

    I had to put a forward slash at the start of the path to the .swf file.

    "/js/swf/copy_csv_xls.swf"

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    @lsharsharao - If it isn't a 404 error you are seeing, then we'll probably need a link to the page to be able to debug what is going wrong.

    Allan

  • lsharsharaolsharsharao Posts: 3Questions: 1Answers: 0

    @allan the page is within the secured server, I will not be able to send the link. If it helps I can send the mock HTML file along with the JS and CSS files I am using .

    Thanks

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Are you able to create an example showing the issue using JSFiddle or https://live.datatables.net ? I don't think just looking that the HTML etc would be enough in this case, I'd need to have an actual running test case that shows the issue so I can debug it.

    Allan

  • lsharsharaolsharsharao Posts: 3Questions: 1Answers: 0

    @allan I have created an example on JSFiddle https://jsfiddle.net/HarshaSridhar/cmdzs6tv/9/

    I have added the JS files of datatables and tabletools to the fiddle as an external resource, but it seems like the datatables is not functional. Not sure if I am missing something crutial.

    Please help

    Thanks

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    1. jQuery wasn't being included
    2. There was not div.info element
    3. The swf path had not been set
    4. There is no buttons option in the TableTools constructor object
    5. There is no type option in TableTools
    6. There is no buttonText option in TableTools

    Fixing all of those should allow it to work - https://jsfiddle.net/cmdzs6tv/10/ .

    However, The SWF has never worked in JSFiddle for some reason. No idea way. Try saving the example locally.

    Failing that, later this week I'm going to release a replacement to TableTools which doesn't need flash.

    Allan

This discussion has been closed.