Skip to content

Have the ability to cancel a delete #305

@biscuit314

Description

@biscuit314

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
    }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions