Hey there, i am currently building an app using an Aggrid Table.
Within the App i am incrementing some variables in my dataframe and try to refresh those data within my aggrid dataframe without reloading the whole page.
Somehow I cannot get it to work using the Aggrid Table without Refreshing the whole Page - anyone got some ideas on what i am doing wrong here?
import streamlit as st
import pandas as pd
import st_aggrid as stagg
import time
df = pd.DataFrame({
'A': [10, 20, 30],
'B': [40, 50, 60],
'C': [70, 80, 90]
})
st.set_page_config(layout="wide")
builder = stagg.GridOptionsBuilder.from_dataframe(df)
builder.configure_column("currency", header_name="", editable=False)
opts = builder.build()
st_table_2 = stagg.AgGrid(df,
reload_data=True,
update_mode=stagg.GridUpdateMode.VALUE_CHANGED,
gridOptions=opts,
columns_auto_size_mode=stagg.ColumnsAutoSizeMode.FIT_CONTENTS
)
control = st.dataframe(df)
while (1):
# Increment some Variable
df['C'] = df['C'] + 1
# Update Values in Table
st_table_2.values = df
# Other Methods tried
# 1.
# st_table_2.data = df
# 2.
# st_table_2 = stagg.AgGrid(df,
# reload_data=True,
# update_mode=stagg.GridUpdateMode.VALUE_CHANGED,
# gridOptions=opts,
# columns_auto_size_mode=stagg.ColumnsAutoSizeMode.FIT_CONTENTS
# )
# Update Control Dataframe
control.dataframe(df)
# Sleep 1 Second
time.sleep(1)