I have two functionalities, and I can do either individually, but I canât seem to figure out how to do both at once:
1). âDynamicâ widgets for dataframe filtering
I have built a number of widgets and corresponding dataframe filters/masks, and sometimes itâs useful to the user to have widgets impact other widgets. For example, you might have a multi_select for day thatâs pre-populated with all seven days, but above it might be a radio with [âallâ, âweekendâ, âweekdayâ] which then alters the default options value in the multi_select. Allowing for dynamic filter widgets also allows you to warn the user immediately if they have something invalid (like if they remove all days from the multi_select example above), as opposed to having to actually submit the query and then return the error.
As far as I can tell, you canât do this using the Streamlit âFormâ capability, but Iâve emulated this by using my own button and check to see if the form has been âsubmittedâ. This works just fine.
2). Any kind of âserver sideâ Pandas dataframe pagination. Iâve implemented the example here (https://share.streamlit.io/streamlit/release-demos/0.84/0.84/streamlit_app.py?page=headliner), and even ported it to use a slider. So this works great too!
(Iâll note here that solutions like Agrid etc. havenât worked for me because they just filter the dataframe on the client; they still send the whole thing at once. The files Iâm dealing seem to be too large in the worst case to do this, so Iâd like to be able to send chunks at a time to increase the user experience)
The problem is, I canât figure out a way of getting both 1) and 2). to work together. Iâve tried a few things, but havenât hit the magic combination of session_state, forms, onSubmit, etc. to get it to work.
This feels like a reasonably common use caseâŠanyone experienced anything similar? Itâs possible something like this is just antithetical to the Streamlit execution paradigm, but I hope not! Itâd hate to have to sacrifice a huge chunk of functionality â being able to offer the user a helpful filter UI â for the simple task of breaking a large dataframe into chunks.
Iâve taken a look at Make st.dataframe more awesome · Issue #1449 · streamlit/streamlit · GitHub, which covers a lot of ground (mostly styling and interactivity, but also efficiency) but there hasnât been a ton of progress lately. Does anyone have any advice in the meantime?
Thanks so much!