I’m trying to delete selected rows in the Ag-Grid table and after deletion update/refresh the Ag-Grid table. Also I would like to save the selected rows to the new DataFrame.
It that possible to do with just one button click (on click on the button the Ag-Grid table updates, deletes the selected rows and saves them to DataFrame)?
I changed your code appropriately for my case and it works!
However I still have two minor problems:
In order to delete the selected rows I must click on the -Row button twice
I want to change/edit the rows and when I remove them I want to save them into a DataFrame for further manipulation. This saving proccess is still causing me some problems.
Regarding the first point: It actually deletes the row after one click, however due to how I setup the logic, the grid isn’t reloaded immediately. Haven’t had the time to figure out a clever way to do this and instantly reload the grid.
And with regards to saving the changes, you can simply create a method that writes the grid['data'] to a new dataframe (or even the same dataframe).
However, it looks like Streamlit will be releasing some rather useful features for editable dataframes within this month, as per their roadmap.
I tried above code it was working fine but now I am seeing below error recently:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
This is occuring at line at if selected_rows: code in delete_row function. Has this functionality changed recently?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.