Export not working for large tables

Export not working for large tables

SwaathySwaathy Posts: 1Questions: 1Answers: 0
edited March 2017 in Free community support

i have a datatable with 11k+ entries . I am using the export excel button to export the table. The export feature works well for tables with less entries. But the page becomes unresponsive when i try to download a table with more than 500 entries .
Can somebody please provide me help with this ?

Answers

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Can you try the nightly version version of Buttons please?

    Allan

  • SoftballSteveSoftballSteve Posts: 3Questions: 0Answers: 0

    I seem to be having the same issue and the nightly version of Buttons does not seem to fix things. My results are about 34k+ and when I click any export button the page becomes unresponsive. No problem with smaller data sets.
    Was there a final solution to this issue or do I need to come up with a different export option?
    Thanks in advance for your help!

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @SoftballSteve ,

    We're happy to take a look, there might be something in your data that's causing the performance issue. As per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • SoftballSteveSoftballSteve Posts: 3Questions: 0Answers: 0

    Hi @colin,

    I was having trouble creating a test case because the results are so big, but managed to get a JSFiddle working. It loads very slowly (10x slower than on my server), but once it loads you can see that sorting, searching, paging, etc. is incredibly fast (which is why I love this tool), but when any export button is clicked, it basically locks the browser. If this is just more data than it was built for, I understand, but hopefully this test case will show that I'm doing something wrong. :)

    Thanks,
    Steve

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Goodness me - that took about a minute to load on my machine! I see you have data and deferRender disabled. Are you using them in your real environment? If so, good - that's a good thing for performance!

    The first think I would suggest is try using the nightly version of DataTables. There was a performance regression in .17 thought to .19 which caused the export to be really slow.

    In fairness, we are getting to the point with 30K+ records that I would expect the browser to be slow on export, but it would be worth trying the nightly in your own dev environment.

    Allan

  • SoftballSteveSoftballSteve Posts: 3Questions: 0Answers: 0

    Unfortunately the nightly version didn't noticeably help and I totally understand that with this much data, it should take a while - I was just hoping there was a way to do it asynchronously or something like that.

    I did want to share something that I found interesting, while debugging I put a couple breakpoints around where the problem occurs (in datatables.js) and saw some interesting behavior.

    When I step one line past this.processing( true ); the button goes into 'processing' mode. (This doesn't happen without the breakpoint)

    Then if I let the code execute from there, the button continues to spin and the "page is unresponsive" dialog does not show up (even though the rest of the buttons don't respond), but most importantly, the export completes (after about 5 minutes on my machine) and the buttons go back.

    Since it will be quite rare that the user will need to export this much data, I think I could get by with alerting the user to go grab a coffee and be patient if there was a way to force it into this mode (I can only achieve in debug).

    Any suggestion on how to do this?

    Thanks again!!

    -Steve

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    When I step one line past this.processing( true ); the button goes into 'processing' mode. (This doesn't happen without the breakpoint)

    Not visibility since the browser hasn't redrawn the page (the Javascript "thread" is still running, so it waits to combine any other updates). A setTimeout there would allow it to work.

    I'm wondering if I should introduce a service worker option for exports. That way the export could be done in the background. I've filed an enhancement bug for that.

    At the moment try wrapping everything after the processing call into a setTimeout function.

    Allan

This discussion has been closed.