diff --git a/stand/webapp.py b/stand/webapp.py index 0d12ddd..af34abf 100644 --- a/stand/webapp.py +++ b/stand/webapp.py @@ -33,12 +33,20 @@ df = restapi.data download(df) +height = st.sidebar.slider( + "Grid Height", + min_value=100, max_value=1500, value=500, step=10, + key="grid_height" +) + + # if df in restapi changed, we need to reload it into aggrid. # if df in restapi did not change, we do not reload to ensure changes in the browser persist. response = aggrid( df, - reload_data=changed + reload_data=changed, + height=height ) diff --git a/stand/widgets/aggrid.py b/stand/widgets/aggrid.py index 6fdd98f..7b8229d 100644 --- a/stand/widgets/aggrid.py +++ b/stand/widgets/aggrid.py @@ -1,8 +1,7 @@ -import streamlit as st from st_aggrid import AgGrid, GridOptionsBuilder -def aggrid(df, reload_data=False): +def aggrid(df, reload_data=False, height=500): df = df[::-1] # display in reversed chronological order gob = GridOptionsBuilder.from_dataframe( @@ -14,12 +13,6 @@ def aggrid(df, reload_data=False): sortable=True ) - height = st.sidebar.slider( - "Grid Height", - min_value=100, max_value=1500, value=500, step=10, - key="gridheight" - ) - # gob.configure_auto_height(True) go = gob.build()