Vue.draggable: Is not possible to track the "history" of a moved item

Created on 7 Dec 2017  路  7Comments  路  Source: SortableJS/Vue.Draggable

The plugin is awesome, but from my point of view has few issues because it's more DOM-driven than data-driven.

Example:
if I move an item from a list with group name 'foo' to a list group name 'bar', I'm expecting to have back an object with:

  • the moved item itself
  • previous index position
  • current index position
  • current list group name
  • previous list group name

and not a HTML nodes

Without this type of informations it is really hard to mutate local states or vuex store states.

Please correct me if I am wrong and give me some suggestions on how to handle this kind of behaviors

Thanks for your time

Most helpful comment

would be nice, if the list has a name and your dealing with multiple lists, to know from which list the item comes from and in which list is added now

All 7 comments

Check change event

@David-Desmaisons yes I did it already: it's where I have these DOM elements back

There should be a way to add names to draggable components ( without any relations with the group name ) and when I move an item between multiple lists, I retrieve the item that I moved, the name of its previous list and its new list.

is this possible?

Well you do not have DOM node on change event only view model information

Could you tell what is missing on the event change?
From the Readme:

change event

change event is triggered when list prop is not null and the corresponding array is altered due to drag-and-drop operation.
This event is called with one argument containing one of the following properties:

added: contains information of an element added to the array
newIndex: the index of the added element
element: the added element
removed: contains information of an element removed from to the array
oldIndex: the index of the element before remove
element: the removed element
moved: contains information of an element moved within the array
newIndex: the current index of the moved element
oldIndex: the old index of the moved element
element: the moved element

would be nice, if the list has a name and your dealing with multiple lists, to know from which list the item comes from and in which list is added now

@MatteoGabriele you can use the clone prop to do such a think.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rootman picture rootman  路  3Comments

iou90 picture iou90  路  3Comments

bborn picture bborn  路  3Comments

karam94 picture karam94  路  3Comments

Nrqz picture Nrqz  路  3Comments