You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the user clicks the "delete a node" button, sometimes we need to check first before completing the deletion. For example:
pop an "are you sure?" to give the user a chance to back out if she clicked delete in error
in the event deleting the backing item in a database or API fails
To allow for this, this feature request is for a new event treeNodeBeforeDelete which allows the application to perform the check then indicate whether the delete should be allowed to continue. For example:
<tree-view ... @treeNodeBeforeDelete="onBeforeDelete" ...>
...
function onBeforeDelete(target) {
const answer = askAreYouSure() // prompts user, returns boolean
return answer
}
// OR
function onBeforeDelete(target) {
const answer = askAreYouSure()
if (answer === false) {
target.cancelDeletion() // or some other manipulation of the target node
}
}
The text was updated successfully, but these errors were encountered:
@biscuit314 I'll probably merge this after the weekend, so if you get a chance to take a look and/or try out the solution let me know. I added a deleteNodeCallback property for the treeNodeSpec that gets called when the delete button is clicked and can return a boolean indicating whether to continue with deletion. If you checkout the source and run yarn storybook there's an Add Remove example with a very lazy Promise.resolve(window.confirm... implementation that should give you the gist of it.
When the user clicks the "delete a node" button, sometimes we need to check first before completing the deletion. For example:
To allow for this, this feature request is for a new event
treeNodeBeforeDelete
which allows the application to perform the check then indicate whether the delete should be allowed to continue. For example:The text was updated successfully, but these errors were encountered: