create sidebar slider in the right place

This commit is contained in:
2022-06-04 23:11:07 +02:00
parent 59000eddde
commit b72078d17c
2 changed files with 10 additions and 9 deletions

View File

@ -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
)

View File

@ -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()