Zicrael / ngx-tree-dnd

Angular 7 support, data sortable draggable smart tree.
https://ngx-tree-dnd.stackblitz.io
MIT License
39 stars 11 forks source link

How can I call an event when delete button is clicked? #26

Closed kapilpundit closed 5 years ago

kapilpundit commented 5 years ago

Hi @Zicrael , This one is similar to an earlier issue I raised #16 . This time I would like you to provide two separate events when delete button is clicked.

Basically, I would like to ask for confirmation before a node is removed from the tree, so a (onStartDeleteItem) and (onFinishDeleteItem) events would be great!.

Thanks,

Zicrael commented 5 years ago

Hi @kapilpundit , okay this one not so hard, but any ideas about confirmation before remove child? modal or just alert or ...?

Zicrael commented 5 years ago

@kapilpundit
FIXED in v2.5.0. Now you can get submit or cancel deleting item. There are 3 new events instead old one. Example:

  (onStartDeleteItem)='onStartDelete($event)'
  (onFinishDeleteItem)='onFinishDelete($event)'
  (onCancelDeleteItem)='onCancelDelete($event)'

removed event: onremoveitem

Zicrael commented 5 years ago

You can check the live example in: https://stackblitz.com/edit/ngx-tree-dnd Hope you enjoy it. Thank you for the star.

kapilpundit commented 5 years ago

Excellent work @Zicrael . Is there a way I can open my own modal div or a popup instead of the confirmation alert box? That would be great as I would like to show some informative message to the user for taking there consent to delete a node in the tree. Thanks.

sarahm7 commented 5 years ago

i would like to know as well if we can override the alert message here. thanks!

hirenkukadiya commented 5 years ago

@sarahm7 you can override message from the script file. find msg and replace it in file.

sarahm7 commented 5 years ago

sorry what do you mean @hirenkukadiya ? i meant the same as @kapilpundit sorry for the confusion.

hirenkukadiya commented 5 years ago

@sarahm7 just find "Do you really want to delete" in script and replace it.

kumarant commented 5 years ago

Hi @hirenkukadiya @Zicrael is there a way to disable the confirmation alert dialog box on delete