SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.76k stars 3.71k forks source link

Dynamic component added below of the last one. #1718

Open imranqau5373 opened 4 years ago

imranqau5373 commented 4 years ago

Problem:

I used sortable with angular 8. I have applied that to dynamic components. sortable is working fine with the list. but if I drag the last one on top and add the new dynamic component. it added just below the last element. before that sortable, it was working fine. if not changed that last one and other. they working fine. please anyone can help me out regarding this issue.

JSBin/JSFiddle demonstrating the problem:


Before you create an issue, check it:

  1. Try master-branch, perhaps the problem has been solved;
  2. Use the search, maybe we already have an answer;
  3. If not found, create an example on jsbin.com (draft) and describe the problem.

Bindings:

waynevanson commented 4 years ago

Do dynamic components create a new component and a new instance of a DOM element? If so, this sounds like it should work.

but if I drag the last one on top and add the new dynamic component

This is unclear. What is "the last one"?

Can you please submit a JS fiddle or code sandbox with your issue? It will help to get it resolved.

imranqau5373 commented 4 years ago

let me explain the scenario. I have one angular component.html that have one div. I render the 4 div's means each div is a component. I render the div component 4 times. I have one button with the name of (add div). now, these 4 div's are sortable and working properly. if I move 4th dive on 1st place and another div with the help of button (add div). new div is added below of the last div that moved in the first place. that is the problem. why new div is not added in the below of the last one.

owen-m1 commented 4 years ago

It wounds like an issue with the code you are running that adds the new div. If you can create a JSBin demonstrating this maybe I can help.