reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
299 stars 118 forks source link

How to replace a list item? #100

Closed wendellestradairely closed 2 years ago

wendellestradairely commented 2 years ago

How to implement a drag & drop to a list wherein instead of inserting the dragged item between two list items, the existing item in the target list will be replaced when the dragged item is dropped?

image

Real-world scenario: Here's what my use-case is. The goal is to drag the field from the right to the text field to the left:

image

reppners commented 2 years ago

Replacing an item in the dropzone instead of adding it is entirely up to the logic that handles the drop.

See https://github.com/reppners/ngx-drag-drop/blob/dee13087197ab7e39f86e1833393e5cd0807fbae/demo/app/list/list.component.ts#L81-L90 for an example of deleting items that are dropped.

reppners commented 2 years ago

Closing as it is not a bug or new feature. If you need further guidance, let me know by adding a comment!

wendellestradairely commented 2 years ago

@reppners Thank you. 😀