Deleting rows in st.data_editor progmatically

Summary

Inspired by the st.data_editor tutorial I wanted to delete programatically.

My goal is to delete the row if the row is checked.

image

image

So it works as intended, you just don’t have to press the delete button. (I am trying to make a notification box, so we can easily dismiss the notifications)

tl. dr.: if you check the row, the row gets deleted dynamically the same as we would be deleting with the “delete” button

Hi @Dewliak,

Thank you for sharing your question with the community!

Your post is missing a code snippet and a link to your app’s GitHub repo. Please check out our guidelines on how to post an effective question here and update your post to help the community answer your question.

Here’s one way to do it. Rather than using the default row picker, this adds an extra column called “x”, and if it is checked, it updates the dataframe (which is stored in session state)

3 Likes

This works well, thank you very much!

Keep up the good work, loving Streamlit

My apologies, I will keep that in mind in the future.

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