Excel Export Button | Uncaught RangeError: Maximum call stack size exceeded | Table is 55K rows

Excel Export Button | Uncaught RangeError: Maximum call stack size exceeded | Table is 55K rows

cippel33cippel33 Posts: 2Questions: 1Answers: 0

Hi everyone! First timer here! I'm having some issues when trying to export out a relatively larger table in Excel (or CSV) formatting. The table itself contains about 55K rows.

As soon as I click on the Export Excel button, I receive the following error:
Uncaught RangeError: Maximum call stack size exceeded

I am using the latest JQuery version, 3.7.1. as well as the most recent DataTables version.

Here is the statement that initializes the table. Any help would be greatly appreciated!

On a side note, I export other tables just fine; so I'm wondering if its just the size of 55K that has exceeded a size limit?

           var table = $('#tblSummary').DataTable( {
              layout: {
                 top1Start: {buttons: ['colvis', 'copy', 'csv', 'excel']},
                 top2Start: 'searchPanes',
                 topEnd: 'search',
                 bottomStart: 'info',
                 bottomEnd: 'paging'
              },
              language: 
              {
                 "emptyTable": "<span style='font-size: 24px; font-weight:bolder;color:green;'>No summary data discovered; please try again later.</span>"
              },
              data: results, 
              autoWidth: false,
              pageLength: 10,
              aaSorting: [], 
              searching: true, 
              paging: true, 
              info: true, 
              stripe: true, 
              lengthChange: false, 
              buttons: ['colvis', 'copy', 'csv', 'excel'],
              columns: [
                 { data: "LOB" },
                 { data: "MNE" },
                 { data: "ENV" },  
                 { data: "Instance" },
                 { data: "LoginName" },
                 { data: "LoginType" },
                 { data: "IsPrivileged" },
                 { data: "IsPrivilegedServerLevel" },
                 { data: "IsPrivilegedDBLevel" },
                 { data: "IsPrivilegedExplicit" }
              ]       .
           });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
    Answer ✓

    There is no formal limit in the DataTable export, but Javascript engines count the number of functions being executed as a result of an action, and it is exceeds whatever number they determine they will throw an error to try and prevent infinite loops. Unfortunately, due to how DataTables / Buttons is doing the export, a lot of functions are called, and although each is very fast, it does trigger this error.

    I need to look at a way to reorganise the code.

    Allan

  • cippel33cippel33 Posts: 2Questions: 1Answers: 0

    Thanks, Allan! I noticed when I use an older version of DataTables, it works just fine. It is just the newest version I am having issues with.

    I'm sure this is probably not an easy fix, so I will just continue to use the older version for now. Thanks again for looking into this!

  • nigel_cascade3dnigel_cascade3d Posts: 1Questions: 0Answers: 0

    I have the same problem, which means that I am unable to continue using this otherwise excellent product. :-(
    cippel33 - please would you advise which older version of DataTables this works in so that I could try that?

  • dharanigdharanig Posts: 1Questions: 0Answers: 0

    We are facing the same issue after upgraded to the latest jquery version of 3.7.1/ datatables version. Unfortunately, we can't revert to the older version. It would be really helpful, if you provide an update on when it's going to be released to fix this issue. Thanks!

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin

    I haven't yet had time to dig into it I'm afraid. If you wish this to be prioratised over other things, priority support is available. Otherwise, I'll try to get to it as soon as I can.

    Allan

  • stephroystephroy Posts: 1Questions: 0Answers: 0

    Hi Allan, just wanted to let you know that we’re also affected by this issue. Returning to v1.10.16 until this can be addressed.
    Thanks.

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin

    I've committed a change to address this issue and it is now in the nightly. It seems to work nicely in Chrome with a 50000x6 table for me (whereas I was getting the same error as reported before the change). However, I'd welcome someone else to try it out from the nightly and confirm the fix before I do the release.

    Allan

  • jybleaujybleau Posts: 15Questions: 1Answers: 0

    Tested, it works fine for me, issue solved.

    Had the same problem when exporting large dataset, over 10k, was wondering what could be wrong with this.push.apply(this, data) until... https://datatables.net/forums/discussion/comment/234249/#Comment_234249

    Thanks

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin

    Yeah, seems a really odd thing and a terrible error message, however, thank you so much for testing it and letting me know. I'll get a release made soon with the change.

    Allan

Sign In or Register to comment.