PablocFonseca/streamlit-aggrid

GridUpdateMode.MANUAL with an external button

caryyu opened this issue · 1 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'])  ```