Closed mabergerx closed 6 months ago
@mabergerx
I was not able to reproduce your issue on my own data example :
here the code
st.subheader('initial df') st.write(df1) st.write(df2)
gb = GridOptionsBuilder.from_dataframe(df1)
gb.configure_selection('single', use_checkbox=False)
gridOptions = gb.build()
gb2 = GridOptionsBuilder.from_dataframe(df2)
gb2.configure_selection('single', use_checkbox=False)
gridOptions2 = gb2.build()
st.subheader(' if you select a row from 1st grid it keeps rows with same id and then if i select a row on 2nd grid I can correctly display the selected row below')
grid_response = AgGrid(df1,
height=100,
gridOptions = gridOptions,
data_return_mode=DataReturnMode.FILTERED,
update_mode=GridUpdateMode.MODEL_CHANGED,
enable_enterprise_modules=True)
line_df1_selected = grid_response['selected_rows'] selected_ids = [row["id"] for row in line_df1_selected] neighbours_df = df2.loc[df2["id"].isin(selected_ids)]
grid_response2 = AgGrid(neighbours_df, height=100, gridOptions = gridOptions2, data_return_mode=DataReturnMode.FILTERED, update_mode=GridUpdateMode.MODEL_CHANGED, enable_enterprise_modules=True)
line_df2_selected = grid_response2['selected_rows'] st.write(line_df2_selected)
I have two
AgGrids
in my view with which I interact using other components like a dropdown and a button.One grid is where the main data is being presented, and the individual rows can be chosen via checkboxes. Once the rows are chosen, a user can click on a button to change the underlying data and trigger the rendering of the second grid, which shows a certain selection of rows from the main view.
Retrieving the selected rows from the main grid goes just fine, and I can successfully render the second grid using the selected rows from the main grid. However, when I try to access the selected rows in the second grid, using all kinds of update modes, I can't get hold of the selected rows without the app re-running. This results in me never being able to retrieve the second selection.
Here is the code:
I can't quite pinpoint the way to actually get the second selected rows without the app re-running, like I seem to able to have in the main grid. Does it have to do something with something in the state?
Thank you very much in advance!