Streamlit with AgGrid - Issue with rendering


My application has three display sections - Side panel for user input, Left and Right Column - Left column displays the AgGrid Table based on the user input - If the user selects a row in the AgGrid table, the chat feature with chat text input will appear in the right column.

If the user input changes, it will result in a new AgGrid Table. Currently, the AgGrid still shows old table values even though the print statement shows the new values of the AgGrid table in the terminal. All other functionality works well. What could be the problem? Any help is much appreciated

Code snippet: for AgGrid table

with left_column:

                        f"""<p><br></br></p> Similar UHC Plans <p><br></br></p>""", unsafe_allow_html = True)

        gb.configure_default_column(groupable = True, value =True, enableRowGroup=True, aggFunc="sum", editable=True)

        ag = AgGrid(plandf, gridOptions=gridOptions, enable_enterprise_modules=True, key="aggrid")
        print('before if statement')

        if ag['selected_rows']:
                        print('inside selected rows')

                        # Get the selected row data when a row is clicked
                        selected_row_data = ag['selected_rows'][0]
                        print('Selected row data:', selected_row_data)
        if selected_row_data:
                        plan_code = selected_row_data['PlanId']
                        handle_chatbot(plan_code, session_state, right_column)
                        session_state.set(f'chat_history_{plan_code}', [])

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Each time the AgGrid table is changed, the left column should refresh with the new table values.

Actual behavior:

The First run AgGrid table values are retained for display even though the print statement shows the AGGrid table is having new values.

Debug info

  • Streamlit version: 1.22.0
  • Python version: Python 3.8.13
  • Using Conda
  • OS version: MacOS Monterey
  • Browser version: Chrome Version 113.0.5672.126
    -Streamlit AgGrid version : 0.3.4.post3


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.