Spaces:
Running
Running
James McCool
commited on
Commit
·
8fb51c2
1
Parent(s):
d98390d
Enhance "Clear Data" button functionality in Handbuilder tab of app.py by introducing a session state variable to control the key, ensuring a proper reset of the player selection editor on each rerun, thereby improving user interactivity and experience.
Browse files
app.py
CHANGED
@@ -802,7 +802,12 @@ with tab3:
|
|
802 |
with tab4:
|
803 |
st.header("Handbuilder")
|
804 |
|
|
|
|
|
|
|
|
|
805 |
if st.button("Clear Data", key='clear_handbuild'):
|
|
|
806 |
st.rerun()
|
807 |
|
808 |
# Prepare the player selection DataFrame (fresh on every rerun)
|
@@ -823,7 +828,7 @@ with tab4:
|
|
823 |
},
|
824 |
use_container_width=True,
|
825 |
hide_index=True,
|
826 |
-
key="
|
827 |
)
|
828 |
|
829 |
# Filter selected players for the lineup
|
|
|
802 |
with tab4:
|
803 |
st.header("Handbuilder")
|
804 |
|
805 |
+
# Use a variable to control the key
|
806 |
+
if 'handbuilder_editor_key' not in st.session_state:
|
807 |
+
st.session_state.handbuilder_editor_key = 0
|
808 |
+
|
809 |
if st.button("Clear Data", key='clear_handbuild'):
|
810 |
+
st.session_state.handbuilder_editor_key += 1 # Change the key to force reset
|
811 |
st.rerun()
|
812 |
|
813 |
# Prepare the player selection DataFrame (fresh on every rerun)
|
|
|
828 |
},
|
829 |
use_container_width=True,
|
830 |
hide_index=True,
|
831 |
+
key=f"handbuilder_editor_{st.session_state.handbuilder_editor_key}"
|
832 |
)
|
833 |
|
834 |
# Filter selected players for the lineup
|