I have a streamlit script that has:
- A ‘add new task’ box, that has a few fields and a submit button
- A dataframe that is within a fragment function (automatically re-runs), and part of that function is that it pulls from an sqlite3 database. I set it this way because the sqlite3 is being changed by a server script and i need to see the latest statuses.
I’d like to have it so I can hit a checkbox or something in a row in the dataframe, which will trigger deletion of that row in the sqlite3 database and then re-run the fragment.
I tried something super simple, which is in my dataframe call, i now added on_select=“rerun” and selection_mode=“single-row”.
table_placeholder.dataframe(df_display, use_container_width=True, column_config=column_config, on_select="rerun", selection_mode="single-row")
Thing is, i get an error: streamlit.errors.StreamlitFragmentWidgetsNotAllowedOutsideError: Fragments cannot write widgets to outside containers.
It seems like this is because it’s trying to rerun from within the fragment. And even if i set it to on_select=a callback function, that still says in the docs that it re-runs.
So what is my best option here?