I try to delete an item from my UI. When I click delete button it’s remove from database but not in UI. after reload my item page it’s remove from UI.
I try to delete an item from my UI. When I click delete button it’s remove from database but not in UI. after reload my item page it’s remove from UI.
2
Answers
To get help on Stack Overflow you will usually need to post broken code examples.
https://www.dataschool.io/how-to-ask-for-coding-help-online/
Though there are no broken code examples, we can probably guess what the problem is here. The most likely case is that you did not update the view after the delete happened.
Whenever you load the page, it receives data of the current state of the database at the time. If you delete something from the database in the meantime, you won’t see the update in browser unless you specifically tell it to.
If you do not update your view, the browser doesn’t know by itself that something should be deleted/inserted/updated.
So you just need to do something like this:
When you delete an item and receive response from the server, just delete the specific item from the DOM.