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

Tables in a Streamlit app have a fixed height that does not work well with lengthMenu or search extensions #275

Open
mwouts opened this issue May 27, 2024 · 1 comment

Comments

@mwouts
Copy link
Owner

mwouts commented May 27, 2024

See for instance https://itables.streamlit.app/ - add the pageLength control to the layout and then try to show 25 rows per page. Then the tables does not fit anymore in its iframe and only 12 rows are visible.

We need to figure out how to make the iframe responsive to the size of its content. I suspect the issue is with

Streamlit.setFrameHeight()

which calculates the height just when the table is initially displayed.

image

@mwouts
Copy link
Owner Author

mwouts commented Nov 12, 2024

I have tried adding a call to Streamlit.setFrameHeight() within the datatable drawCallBack but that causes the whole application to re-update continuously.

I see that the disqus component for Streamlit encountered the exact same issue a while ago, see streamlit/streamlit#1525. The issue was closed as fixed however the problem is still around and the Disqus component now uses

import ResizeObserver from "resize-observer-polyfill"

see https://github.com/okld/streamlit-disqus/blob/main/streamlit_disqus/frontend/src/height-observer.tsx.

Another possible options could be the MutationObserver described here in SO

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

1 participant