create sidebar slider in the right place
This commit is contained in:
@ -33,12 +33,20 @@ df = restapi.data
|
|||||||
download(df)
|
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 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.
|
# if df in restapi did not change, we do not reload to ensure changes in the browser persist.
|
||||||
|
|
||||||
response = aggrid(
|
response = aggrid(
|
||||||
df,
|
df,
|
||||||
reload_data=changed
|
reload_data=changed,
|
||||||
|
height=height
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import streamlit as st
|
|
||||||
from st_aggrid import AgGrid, GridOptionsBuilder
|
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
|
df = df[::-1] # display in reversed chronological order
|
||||||
|
|
||||||
gob = GridOptionsBuilder.from_dataframe(
|
gob = GridOptionsBuilder.from_dataframe(
|
||||||
@ -14,12 +13,6 @@ def aggrid(df, reload_data=False):
|
|||||||
sortable=True
|
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)
|
# gob.configure_auto_height(True)
|
||||||
go = gob.build()
|
go = gob.build()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user