This commit is contained in:
2022-05-22 21:50:38 +02:00
parent c7fecfc60e
commit 21a06c9782
3 changed files with 15 additions and 5 deletions

View File

@ -4,6 +4,7 @@ from st_aggrid import AgGrid, GridOptionsBuilder
import hacks import hacks
from restapi import restapi from restapi import restapi
from utils import make_key
from utils.st_utils import get_session_id, rerun, hide_UI_elements from utils.st_utils import get_session_id, rerun, hide_UI_elements
from utils.df_utils import to_excel_binary from utils.df_utils import to_excel_binary
@ -24,10 +25,6 @@ changed = restapi.changed
df = restapi.data df = restapi.data
# encode the column names into the key, thus trigger a hard reload (like F5) when the columns change
key = "stand:" + "+".join(str(col) for col in df.columns)
print(">>> start of streamlit run") print(">>> start of streamlit run")
@ -77,7 +74,7 @@ response = AgGrid(
fit_columns_on_grid_load=True, fit_columns_on_grid_load=True,
reload_data=changed, reload_data=changed,
key=key key=make_key(df)
) )

View File

@ -0,0 +1,4 @@
from .utils import *

9
utils/utils.py Normal file
View File

@ -0,0 +1,9 @@
def make_key(df):
"""
encode the column names into the key,
this triggers a hard reload (like F5) when the columns change
"""
return "stand:" + "+".join(str(col) for col in df.columns)