You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A
...................
Apple
Banana
Cherry
"--container--"
B
..................
Cat
Dog
"--container--"
If I grab the second from the last item (Banana) and drag it to the last position (After Cherry), your "container" sentinel (I'm guessing) moves with the last item like below
Apple
Cherry
"--container--"
Banana
Now when I drag a new item from list B to the bottom of list A. the item is added above the contaner instead of being added to the end.
What I see:
Apple
Cherry
Cat
"--container--"
Banana
What I expect:
Apple
Cherry
Banana
Cat
"--container--"
It is my view that the container is incorrectly moving with the last item in the sort, then adding a new item via drag is inserting the drop in the incorrect location.
Adding this code to my 'onEnd' callback corrects the issue
event.to.childNodes.forEach((value: ChildNode, key: number) => {
// Find sentinel container
if (value.nodeValue === "container") {
// Remove sentinel container from current position and place it at the end.
const container: ChildNode = event.to.removeChild(value);
event.to.appendChild(container);
}
});
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
When sorting list A.
A
...................
Apple
Banana
Cherry
"--container--"
B
..................
Cat
Dog
"--container--"
If I grab the second from the last item (Banana) and drag it to the last position (After Cherry), your "container" sentinel (I'm guessing) moves with the last item like below
Apple
Cherry
"--container--"
Banana
Now when I drag a new item from list B to the bottom of list A. the item is added above the contaner instead of being added to the end.
What I see:
Apple
Cherry
Cat
"--container--"
Banana
What I expect:
Apple
Cherry
Banana
Cat
"--container--"
It is my view that the container is incorrectly moving with the last item in the sort, then adding a new item via drag is inserting the drop in the incorrect location.
Versions
"sortablejs": "1.15.1",
"@types/sortablejs": "1.15.8",
Additional context
Adding this code to my 'onEnd' callback corrects the issue
The text was updated successfully, but these errors were encountered: