Dears,
I use MongoDB to store data, but I facing one issue that the ag-grid did not refresh after click customize button to delete selected row.
please advise how to achieve this goal, thanks!
Dears,
I use MongoDB to store data, but I facing one issue that the ag-grid did not refresh after click customize button to delete selected row.
please advise how to achieve this goal, thanks!
I have the same issue, but it works (in terms of deleting the row) when I check the select box for that row a second time. I’ve never been able to figure out a solution, but haven’t looked into it too hard as it’s kind of functional. I think it’s because the aggrid component doesn’t refresh after the first deletion.
Hi @ac3
thank you for your comment.
You need to use the grid builder. It will be something like this:
1) Import gridoptionsbuilder
from st_aggrid import AgGrid, GridOptionsBuilder
2) Make object (and apply the settings you like)
gb = GridOptionsBuilder.from_dataframe(loaded_data)
gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, aggFunc='sum', editable=True)
gb.configure_selection('multiple', use_checkbox=False, groupSelectsChildren=True, groupSelectsFiltered=True)
gb.configure_pagination(enabled=True)
my_gridOptions = gb.build()
3) Apply to Aggrid
new_dataframe = AgGrid(loaded_data,
gridOptions = my_gridOptions,
update_mode=GridUpdateMode.MODEL_CHANGED
)
See the link for all details
Hi, @lee0423! I’ve just had the same issue and what I did was inserting an empty button (that doesn’t explicitly trigger any event) that, when clicked, updates the table without having to double click or unselect the row. I know it might not be the most efficient solution, but (in my opinion) was the best I found in terms of user experience and interface. The code should be something like:
col1, col2= st.columns(2)
remove_row_button = col1.button("Remove Selected Row")
refresh_button = col2.button("Refresh Grid")
Hope this helps!
@matheusmafraoandrade can you please provide the code full code i.e the code which removes the selected row from grid. please. I have tried multiple ways but was unable to achieve it. even tried in github : python - streamlit AgGrid deleting row doesnt refresh data in the backend - Stack Overflow
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.