first working prototype
This commit is contained in:
55
stand.py
Normal file
55
stand.py
Normal file
@ -0,0 +1,55 @@
|
||||
import streamlit as st
|
||||
from st_aggrid import AgGrid
|
||||
|
||||
import hacks
|
||||
|
||||
from restapi import api
|
||||
from utils.st_utils import get_session_id, rerun
|
||||
|
||||
|
||||
st.set_page_config(layout="wide")
|
||||
|
||||
|
||||
api.sid = get_session_id() # rest api needs current session ID to trigger the next rerun
|
||||
|
||||
changed = api.changed
|
||||
df = api.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:
|
||||
api.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")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user