James McCool commited on
Commit
b27b8d0
·
1 Parent(s): 3eb2035

Improve filter reset functionality in app.py

Browse files

- Added a new button to reset filters while preserving essential session state keys, enhancing user control over displayed data.
- Introduced a clearer layout for the filter options, improving the user interface and overall experience.

Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -266,8 +266,15 @@ with tab2:
266
  if 'display_contest_info' in st.session_state:
267
  with st.expander("Info and filters"):
268
  st.info("Note that any filtering here needs to be reset manually, i.e. if you parse down the specific users and want to reset the table, just backtrack your filtering by setting it back to 'All'")
269
- if st.button('Clear data', key='reset3'):
270
- st.session_state.clear()
 
 
 
 
 
 
 
271
 
272
  with st.form(key='filter_form'):
273
  users_var, entries_var, stack_var, stack_size_var, player_var, remove_var = st.columns(6)
 
266
  if 'display_contest_info' in st.session_state:
267
  with st.expander("Info and filters"):
268
  st.info("Note that any filtering here needs to be reset manually, i.e. if you parse down the specific users and want to reset the table, just backtrack your filtering by setting it back to 'All'")
269
+ clear_col, reset_col, blank_col = st.columns(1, 1, 8)
270
+ with clear_col:
271
+ if st.button('Clear data', key='reset3'):
272
+ st.session_state.clear()
273
+ with reset_col:
274
+ if st.button('Reset filters', key='reset4'):
275
+ for key in st.session_state.keys():
276
+ if key not in ['Contest', 'Contest_file', 'Contest_upload', 'player_info', 'info_maps']:
277
+ del st.session_state[key]
278
 
279
  with st.form(key='filter_form'):
280
  users_var, entries_var, stack_var, stack_size_var, player_var, remove_var = st.columns(6)