Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] How to cancel after drop event is emitted ? #149

Open
marcio199226 opened this issue Jul 2, 2019 · 2 comments
Open

[question] How to cancel after drop event is emitted ? #149

marcio199226 opened this issue Jul 2, 2019 · 2 comments

Comments

@marcio199226
Copy link

I have a question once an element was dropped and I'm listening on drop event within ngxDroppable for displaying a confirm popup if container's of dragged element was changed.
This popup has 2 buttons of course CANCEL | CONFIRM and when user clicks on cancel I would revert that dragged element and place it into it's initial container.

How can i achieve this ?

    <div class="list-cards ngx-dnd-container" [id]="layer1.id" ngxDroppable="card" (drop)="onDrop($event)">
      <custom-element [id]="layer1.id" ngxDraggable class="ngx-dnd-item"
        *ngFor="let layer0 of layer1.layers0" [model]="layer1">
      </custom-element>
    </div>

I saw that already exists an issue #5 but there are no workarounds or pull requests until now.

Can you provide some solution?

@marcio199226
Copy link
Author

Ok i have fixed it by relying on angular's dom patching through trackBy and playing with my collection instead of relaying on dragula's dom manipulation which moves or removes nodes based on dnd events

@musman013
Copy link

hi,

by any chance, do you still have that solution and can share or explain it more?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants