How to add a new row when button click on ag-grid?

Dears:

I would like to insert a new row on ag-grid when button click, I refer the Ag-grid docs that it might use the api.applyTransaction(transaction) but still don’t know how to achieve.

thanks in advance.

Hi, have you found any method to solve this?

Hi, You can refer to this Ag-Grid component with input support - #333 by Max_Witteman. Another possible way for this is to have a separate button add row after the table (I haven’t used any functions from AgGrid). When the button is pressed you append a blank row to the data frame stored in Session State and use the st.autorefresh to refresh the grid.

Thanks for the answer! Is there any possiblility to add a new aggrid button like the method shown in AgGrid Documnetation ?

I’m now using two streamlit button to deal with it, but each time when streamlit button clicked the page refreshed again, and the aggrid component will always vanish and display again. I want to try if an aggrid button will keep the component display as always when add row button clicked.

For my case I have used Session State to store and edit the values in data frame.

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