Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download table using buttons feature errors out #251

Open
Dekermanjian opened this issue Mar 27, 2024 · 12 comments
Open

download table using buttons feature errors out #251

Dekermanjian opened this issue Mar 27, 2024 · 12 comments

Comments

@Dekermanjian
Copy link

I have a table that is relatively small ~16,000 rows and 17 columns. When I try downloading the table I get the following error:

Uncaught RangeError: Maximum call stack size exceeded

Playing around with the table looks like the maximum number of rows I can download is ~7000, but also I can download all the rows if I exclude a bunch of columns.

Any ideas on what is going on here?

@mwouts
Copy link
Owner

mwouts commented Mar 27, 2024

Hey @Dekermanjian , thanks for reaching out. Which browser are you using? Can you share an example?

I did a quick google search and I found this: https://datatables.net/forums/discussion/68594/error-uncaught-rangeerror-maximum-call-stack-size-exceed-in-new-version-of-chrome-91-0-4472-77, which is probably related (but not very conclusive, an MRE would be required to further investigate).

@Dekermanjian
Copy link
Author

Hey @mwouts thank you for the quick response. I was using Google Chrome I also tried Microsoft Edge. Let me see if I can generate a reproducible example because my actual dataset has patient sensitive data.

@mwouts
Copy link
Owner

mwouts commented Mar 27, 2024

Yes sure! By the way you can generate a sample df with generate_random_df if that helps. Thanks!

@Dekermanjian
Copy link
Author

Hey here is a quick reproducible example I put together. I also tried it using Safari on a MacOS and I have the same issue. This is being inserted into a quarto Reveal.js presentation by the way.

I am having a hard time pasting the code without the markdown and cells being altered by GitHub. I hope this is clear:

---
title: "Test"
author: "TestAuthor"
date: last-modified
format:
  revealjs:
    controls: true
    scrollable: true
    smaller: false
    embed-resources: true
    height: 950
    width: 2000
execute:
  echo: false
jupyter: python3
---

```{python Imports}
#| include: false
import pandas as pd
import numpy as np
from itables import init_notebook_mode
from itables import JavascriptFunction
from itables import show
import itables.options as opt
opt.style = "table-layout:auto;width:100%"
opt.css = """
.itables table td {font-size: 20px;}
.itables table th {font-size: 20px;}
"""
opt.maxBytes = 0
opt.dom = "frtip"
# pio.renderers.default = "notebook"
df = pd.DataFrame(np.random.rand(16000, 20))

Slide title

#| include: true
init_notebook_mode(all_interactive=True, connected=False)
opt.dom = "Bfrtip"
show(
  df,
  lengthMenu=[17]
)

@mwouts
Copy link
Owner

mwouts commented Mar 27, 2024

Thanks for the example! In Ubuntu/Firefox I can download the test data without any issue:
image

But then when I open the same document in Chromium the download never happens.

@AllanJard I am attaching the HTML document if you wanted to give a quick look? Thanks!
download_csv_excel_slow_or_fails_in_chrome.zip

@Dekermanjian
Copy link
Author

Hmm okay let me try Firefox.

@Dekermanjian
Copy link
Author

Dekermanjian commented Mar 27, 2024

I can confirm that is working on Firefox on MacOS. Any idea why Chrome fails?

@mwouts
Copy link
Owner

mwouts commented Mar 27, 2024

No sorry - ITables is just a wrapper to DataTables, authored and maintained by Allan and his team, but at least now we have an example, so let's see what he finds!

@Dekermanjian
Copy link
Author

Okay, thank you very much for the quick response!

@AllanJard
Copy link

Chrome is showing me Maximum call stack sizer exceeded. I can reproduce that with a manual call to .cells().render() in that example. The 16000 rows * 20 cells, must be just enough to trigger this behaviour in Chrome (Firefox must have a higher threshold).

I'll need to find some way of changing how the API operates to make things faster, which I already knew, I just hadn't seen it quite like this. I can't say when I'll get a chance to do that as I think it will be quite a major piece of work.

@mwouts
Copy link
Owner

mwouts commented Mar 28, 2024

Thanks @AllanJard for looking into this! No worry, at least we have identified a workaround so far (show less rows / use Firefox).

What is the best way to get an update for these kind of fixes? I registered to watch the releases of https://github.com/DataTables/DataTables but maybe there is another way?

@AllanJard
Copy link

AllanJard commented Apr 8, 2024

Sorry for the delay replying here! The DataTables/DataTables repo is legacy and no longer updated. All the action happens in [DataTables/DataTablesSrc](/DataTables/DataTablesSrc]. I've got an RSS feed for releases, or a JSON API if you prefer. I've also been experimenting with posting on BlueSky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants