Vue.draggable: Draggable adds undefined element to list when using draggable option

Created on 11 Dec 2019  路  3Comments  路  Source: SortableJS/Vue.Draggable

First check https://github.com/SortableJS/Vue.Draggable/blob/master/CONTRIBUTING.md

Jsfiddle link

https://jsfiddle.net/94r7ewtn/

Step by step scenario

  1. Open JS console
  2. Drag the last item in the list to the top

Actual Solution

JS error appears in console:
TypeError: Cannot read property 'name' of undefined

Expected Solution

Should not raise an error when dragging.

It looks like Draggable is adding an undefined item to the list. Maybe it's looping through the draggable wrapper element's children and adding the first, non-draggable item even though the "draggable" prop has been set to ignore it?

Most helpful comment

@David-Desmaisons thanks - looks like the header slot option only works if the header is placed after the draggable elements. If the header slot is placed first, same error occurs.

Might be worth adding to the docs.

All 3 comments

For this kind of scenario use header slot.

@David-Desmaisons thanks - looks like the header slot option only works if the header is placed after the draggable elements. If the header slot is placed first, same error occurs.

Might be worth adding to the docs.

the header slot option only works if the header is placed after the draggable elements

@bborn thank you for saving me after 3-4 hours of trying virtually everything.. 馃檱

For me, the issue was that the moved.element was undefined in the event payload.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Stetzon picture Stetzon  路  3Comments

ghost picture ghost  路  3Comments

clemsontiger picture clemsontiger  路  3Comments

AlexandreBonneau picture AlexandreBonneau  路  3Comments

fedenko picture fedenko  路  3Comments