56 lines
911 B
Python
56 lines
911 B
Python
import streamlit as st
|
|
from st_aggrid import AgGrid
|
|
|
|
import hacks
|
|
|
|
from restapi import restapi
|
|
from utils.st_utils import get_session_id, rerun
|
|
|
|
|
|
st.set_page_config(layout="wide", page_icon="icon.png")
|
|
|
|
|
|
restapi.sid = get_session_id() # rest api needs current session ID to trigger the next rerun
|
|
|
|
changed = restapi.changed
|
|
df = restapi.data
|
|
|
|
|
|
|
|
print(">>> start of streamlit run")
|
|
|
|
|
|
response = AgGrid(
|
|
df,
|
|
|
|
filter=True,
|
|
editable=True,
|
|
sortable=True,
|
|
resizable=True,
|
|
|
|
# defaultWidth=5,
|
|
fit_columns_on_grid_load=True,
|
|
|
|
reload_data=changed,
|
|
key="stand"
|
|
)
|
|
|
|
|
|
new_df = response.get("data")#, df)
|
|
if not new_df.equals(df) and not changed:
|
|
restapi.data = new_df
|
|
# print("old:")
|
|
# print(df)
|
|
# print("new:")
|
|
# print(new_df)
|
|
# print(">>> force rerun")
|
|
# rerun()
|
|
|
|
#st.dataframe(df.astype(str))
|
|
#st.dataframe(new_df.astype(str))
|
|
|
|
print(">>> end of streamlit run")
|
|
|
|
|
|
|