refactor
This commit is contained in:
7
stand.py
7
stand.py
@ -4,6 +4,7 @@ from st_aggrid import AgGrid, GridOptionsBuilder
|
||||
import hacks
|
||||
|
||||
from restapi import restapi
|
||||
from utils import make_key
|
||||
from utils.st_utils import get_session_id, rerun, hide_UI_elements
|
||||
from utils.df_utils import to_excel_binary
|
||||
|
||||
@ -24,10 +25,6 @@ changed = restapi.changed
|
||||
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")
|
||||
|
||||
@ -77,7 +74,7 @@ response = AgGrid(
|
||||
fit_columns_on_grid_load=True,
|
||||
|
||||
reload_data=changed,
|
||||
key=key
|
||||
key=make_key(df)
|
||||
)
|
||||
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
|
||||
from .utils import *
|
||||
|
||||
|
||||
|
9
utils/utils.py
Normal file
9
utils/utils.py
Normal 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)
|
||||
|
||||
|
Reference in New Issue
Block a user