Unable export to Excel with Javascript sourced data but it is working for DOM data

Unable export to Excel with Javascript sourced data but it is working for DOM data

vk4bodduvk4boddu Posts: 12Questions: 1Answers: 0

Export to Excel is not working with Javascript sourced data(JSON) but it is working for DOM data. I can use DOM data but having issue with performance. So I used JSON data to load DataTable but Export option is not working. Please help on this. Thanks in advance.

Replies

  • vk4bodduvk4boddu Posts: 12Questions: 1Answers: 0

    Please help on this it is very urgent. I am using the latest DataTable and latest Buttons.

  • allanallan Posts: 62,316Questions: 1Answers: 10,226 Site admin

    Per the forum rules, please link to a test case showing the issue. If it is urgent, priority support is available.

    Allan

  • vk4bodduvk4boddu Posts: 12Questions: 1Answers: 0

    Thanks Alan. This is intranet site so I ca not provide the link. I will provide the code is that ok?

  • vk4bodduvk4boddu Posts: 12Questions: 1Answers: 0

    Alan, I used the same code as given in the Buttons example in this site. When I use DOM population export to Excel working fine. Due to DOM performance, get the JSON data and assigning to DataTable while initializing using the data property after this change Export to Excel is not working.

    Here dataset is the JSON data object.

    var table = $('#residentReport').DataTable({
    data:dataset,
    buttons: [
    {
    extend: 'excel',
    text: Export To Excel',
    title: 'Report To Excel'
    }
    ]
    });

    Thanks,
    Vijay Boddu

  • allanallan Posts: 62,316Questions: 1Answers: 10,226 Site admin

    I'm afraid I would need a test case showing the issue to be able to offer any help. http://live.datatables.net and JSFiddle are available if you would like to create one so I can debug it.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    What happens when you try to export? Does it export a blank page? does no file get generated at all? are there any errors in the console?

    And either the page with the code, or something on live.datatables.net where we could replicate it would be a great help

  • vk4bodduvk4boddu Posts: 12Questions: 1Answers: 0

    Thanks Allan & jLinux trying to help me on this issue. I find the issue and resolved it. My model (which is converting to JSON) has Boolean data type property so it not allowing me to export. Once I changed the data type from Boolean to string for that property it is working fine.

This discussion has been closed.