question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag and drop does not work correctly when data is changed while dragging

See original GitHub issue

What is the expected behavior?

When change data while dragging, for example when have lazy load of items. D&d should update siblings and draggables

What is the current behavior?

current just ignore, cuz copy data before drag https://github.com/angular/material2/blob/master/src/cdk/drag-drop/directives/drop-list.ts#L322 https://github.com/angular/material2/blob/master/src/cdk/drag-drop/drop-list-ref.ts#L179

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
JarekTorocommented, Jun 7, 2019

This is the solution I have found. It has Pros and Cons but i believe it can be improved further.

Listen To Move Event From cdkDrag

          (cdkDragMoved)="moved($event)"

Call $event.source.dropContainer.start();

 moved($event: CdkDragMove<any>) {
      $event.source.dropContainer.start();
  }

How this works. When you call

 $event.source.dropContainer.start();

It runs this code

    this._siblings.forEach(sibling => sibling._startReceiving(this));

That tells the dynamically added DropList to start listening for cdkDrag Items.

Pros:

  • It Works

Cons:

  • I don’t like it that the $event.source.dropContainer.start(); gets called a lot during the drag
  • A few times the cdkDrag component losses reference to its hostElement
1reaction
rebendajirijrcommented, Feb 2, 2022

Unfortunately, the @JarekToro workaround does not work for me. Has anybody implemented some other way?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Drag And Drop Things in Windows 10? Here's How to ...
In File Explorer, click any file or folder and hold the left button on your mouse. Then, press the Esc key. Now, try...
Read more >
Fix: Drag and Drop Not Working on Windows 10/8/7 - YouTube
Fix: Drag and Drop Not Working on Windows.Commands Used: sfc /scannowDISM.exe /Online /Cleanup-image /RestorehealthIssues addressed in this ...
Read more >
Drag and drop not working in Windows 11? Try these fixes!
Oh no ! Drag and drop not working in Windows 11? Try these fixes!This video will show you how to do it! Dragging...
Read more >
Why is Drag and Fill Handle Not Working in Excel? - YouTube
In this video I tell you how to fix a problem where the fill handle in Excel is not working. If you can't...
Read more >
Fix problem: Drag and drop not working in Windows
When drag and drop does not work, left-click a file in File Explorer and keep the left click mouse button pressed. While the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found