DataTables 2.0 Excel Export Uncaught RangeError: Maximum call stack size exceeded
DataTables 2.0 Excel Export Uncaught RangeError: Maximum call stack size exceeded
Hello,
After upgrading from 1.13.1 to 2.0.x I found that the export to Excel button function has stopped working on larger datasets, where we have multiple columns of data.
Here is the error we are receiving:
Uncaught RangeError: Maximum call stack size exceeded
at new U (datatables.min.js:30:45597)
at U.iterator (datatables.min.js:30:46841)
at U.<anonymous> (datatables.min.js:30:65184)
at U.render (datatables.min.js:30:47734)
at u (datatables.min.js:40:25642)
at U.<anonymous> (datatables.min.js:40:23735)
at Function.exportData (datatables.min.js:30:47734)
at U.action (datatables.min.js:60:20955)
at r (datatables.min.js:40:6771)
at datatables.min.js:40:6949
As a sample, I have created fiddler example that does not work with the existing but would work with the old.
https://jsfiddle.net/rnovoa/szdrnake/4/
I've also run debugger configuration: asibeq
This question has an accepted answers - jump to answer
Answers
Thank you for the test case. I don't have an immediate fix I'm afraid. It works in Firefox, but Chrome isn't happy. I'll look into it and reply back here.
Allan
Thanks for looking into this
rnovoa
Hey was there a solution to this issue? I am encountering a similar problem with export excel in version 2.0.8 and 2.0.7. I have about 7k records and am facing a maximum stack call error on chrome and safari. Oddly it works on Firefox. Is there a way to fix this?
Firefox appears to have a higher allowance for this, or perhaps it have a different method for checking for infinite loops. I haven't had a chance to sit down and focus on trying to resolve this yet I'm afraid. It is something I'm aware of though and will be trying to make some time to look into it as soon as I can.
Allan
Hello. Just checking if there is a solution for this issue. I'm trying to upgrade to 2.0 and still get this error. Unfortunately users rely heavily on Excel generation and it's a controlled environment so only Chrome and Edge are allowed, so no Firefox.
Thanks for looking into it.
Elias
I haven't yet dug into this I'm afraid. It is on my agenda, it just hasn't been reached yet.
Allan
Hi Allan.
Thanks for the quick reply. Do you have a ballpark timeframe when will this be looked into? I have a large production application with large amounts of data and as I mentioned users require Excel generation.
Thanks again.
Elias
I haven't had anyone with a paid support package ask about this yet, which is one to the main reasons I haven't been able to prioritise it over other things. I would hope to look at on the next week or two though.
Allan
I think I have a solution for this....
in the _Api constructor function:
It is possible that .apply is exceeding the amount of arguments with large data sets or large amounts of columns (both in my case).
Making this change to my local copy of the datatables.js file seemed to correct the issue.
Interesting - thanks for posting this. That gives me another avenue to look into!
Allan
With @professormudd's suggestion I think this is fixed. Thank you for your insight!
I've committed the change 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
I tried a table with more than 6 columns(actually 7 columns) and 20,000 rows of table, but the same problem still occurred. feedback to you. Thanks.
Hi - thanks for testing the change. Can you give me a link to a page showing the issue please?
I've just tried it here and it appears to work okay for a 20'000 x 7 table.
Possibly your page is using an old cached version of the nightly? Try adding a query string to it like in my example or link above.
Allan
Hi, Allan:
Your example code import css file & js lib
I used file is different from yours.
I changed it to the same file as yours. Now it's work very fine.
Thanks your help.
Vincent
Hi Allan,
we had the same issue in one of our implementations and we have just switched to the same nightly for testing also. With the nightly the issue is gone for us as well.
Really nice that you managed to resolve it that fast.
Do you have any schedule for when this fix will go to the actual release?
Thanks,
Alex
hi, I have the same issues
Uncaught RangeError: Maximum call stack size exceeded
I have imported the css file & js lib mentioned by @vt167098 but it not working for me.
I have 7000 data with 40++ column
It working on firefox, but not working in Edge.
Thank you
Hi, alan1903:
I try 9000+ data with 37 cloumns, It's work fine on chrome and edge.
You can try import below files
I expect to do a release on Friday with the update.
Allan
Hi allan,
Thank you for addressing this. I was able to test the code the nightly in Chrome and I was successfully able to extract to excel 50k records with 12 columns.
Looking forward to the release.
hi @vt167098 . Yes, i did import those file. But still no working.
@alan1903 If you link to a page showing the issue I'll take a look and try to debug it.
Allan
Hi Allan,
I have tested on the latest release and the export to Excel button function issue has been resolved.
Thanks,
Hi @allan,
I think We need to do this change in the following function too,
function _fnFilterCustom( settings )
{
var filters = DataTable.ext.search;
var displayRows = settings.aiDisplay;
var row, rowIdx;
Agreed - thanks for flagging that up. I'll make that change tomorrow.
Out of interest, how many rows do you have?
Allan
161,933 entries.
If you want I can create a PR on this.
Fix committed here. It will be in 2.1.9 when I release it, which I expect to do later this week.
Allan
Hi @allan,
Do we have any release date for 2.1.9 ?
Sorry, yes it has slipped behind a bit due to focusing on Editor 2.4 changes. I don't expect it to be too far away - hopefully this week for DataTables and next for Editor.
Allan