PablocFonseca / streamlit-aggrid

Implementation of Ag-Grid component for Streamlit

Home Page:https://pypi.org/project/streamlit-aggrid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GridUpdateMode.MANUAL with an external button

caryyu opened this issue · comments

How can i use an external button to get all the selected rows when the update_mode is solely GridUpdateMode.MANUAL? The document says it will only draw a built-in one in the top of the table.

agg = AgGrid(..... update_mode=GridUpdateMode.MANUAL...)
selectedRows = agg['selected_rows'] # only until the external button is hit

You can put your AgGrid in a form see the examples

import streamlit as st
import numpy as np
import pandas as pd

from st_aggrid import AgGrid, DataReturnMode, GridUpdateMode, GridOptionsBuilder

df_template = pd.DataFrame(
    '',
    index=range(10),
    columns=list('abcde')
)

with st.form('example form') as f:
    st.header('Example Form')
    response = AgGrid(df_template, editable=True, fit_columns_on_grid_load=True)
    st.form_submit_button()

st.write(response['data'])  ```