#https://stackoverflow.com/posts/76562670
import streamlit as st
import pandas as pd
df = pd.DataFrame({"col": ["foo", "baz", "qux"]})
st.data_editor(df, key="OK")
if st.button("Show another df"):
st.data_editor(df, key="KO")
Hi @tonykip, thanks for your reply. The two dataframes are completely indenpendent. I used two in my example just to show that when using st.data_editor inside an if st.button(): bloc, the behaviour changes. I posted a solution in SO. Can you tell me if itβs the right way to do it, please ?
Since the data editor is a widget the causes a rerun, nesting it under a button will cause it to disappear when you interact with it. Buttons donβt remain True through successive reruns.