Confirmation for Editing Data Editor

I have a streamlit app that uses the data_editor. I’d like to add a confirmation dialog when if the user deletes an entry. Is that possible and if so, how would you suggest doing that?

It is a good programming practice to save the data from data editor changes thru a button. A user can edit anything in the data editor but they are only saved once a button is clicked.



The data editor has an on_change parameter that would allow us to see the changes on the data. There are 3 dictionary keys on the changes, edited_rows, added_rows and deleted rows. Since your are interested on the deleted_rows, check if there is a value on this key, if there is, that is your hint that something is deleted. You can create a session variable to handle this delete state and use it to save or not save the edited dataframe.


Thanks @ferdy !

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