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
This is a Jsfiddle link to show that the SortableJS library in itself deals perfectly fine with this scenario — therefore indicating that the issue might come from VueDraggable: https://jsfiddle.net/dpm9vryb/6/
Step by step scenario
create a Vue component
in this component, create two Sortable containers with <draggable/> component
for each of them, set the props :group="{ name: 'drag', pull: pull }"
add a pull() method to your component with the following code:
pull(){// check something, and depending on the result, return either 'clone' or trueif(currentlyPressingControlKey){return'clone'}else{returntrue}}
add v-model="items_1" and v-model="items_2" to the container elements
manage these items_1 and items_2 array with Vuex as advised by the docs:
If the user clones from List1 to List2 with ctrlKey pressed, these three things should happen:
the item being cloned should still appear visually in the origin container's html element
the item being cloned should still be contained in the newList value passed to the Vuex action callback for items_1 (the origin list)
the item being cloned should appear in the newList value passed to the Vuex action callback for items_2 (the destination list)
Actual Behaviour
Among these three expected behaviours, only 1. and 3. happen, and 2. does not.
It means that visually, the old list still contains the cloned (duplicated) item, and the item was correctly passed to the destination list in Vuex. However, Vuex received an update for the origin list which doesn't contain the duplicated item anymore, and therefore according to Vuex state, the origin list now doesn't contain the item anymore, which is in total contradiction with what the user sees visually.
Important note
When the group.pull parameter is hard-set to pull: 'clone', then everything works correctly and Vuex receives the correct items for each of the two lists.
The issue described above only happens when the pull: 'clone' value is determined programmatically via a function.
Impact
It seems that this issue causes a total impossibility for VueDraggable to provide a "duplicate-on-demand" (e.g. user presses Ctrl Key while dragging) capability. If it was not for this bug, it would be perfectly feasible.
The text was updated successfully, but these errors were encountered:
First check https://github.com/SortableJS/Vue.Draggable/blob/master/CONTRIBUTING.md
Jsfiddle link
This is a Jsfiddle link to show that the SortableJS library in itself deals perfectly fine with this scenario — therefore indicating that the issue might come from VueDraggable: https://jsfiddle.net/dpm9vryb/6/
Step by step scenario
<draggable/>
component:group="{ name: 'drag', pull: pull }"
pull()
method to your component with the following code:v-model="items_1"
andv-model="items_2"
to the container elementsitems_1
anditems_2
array with Vuex as advised by the docs:Expected Behaviour
If the user clones from List1 to List2 with ctrlKey pressed, these three things should happen:
newList
value passed to the Vuex action callback foritems_1
(the origin list)newList
value passed to the Vuex action callback foritems_2
(the destination list)Actual Behaviour
Among these three expected behaviours, only 1. and 3. happen, and 2. does not.
It means that visually, the old list still contains the cloned (duplicated) item, and the item was correctly passed to the destination list in Vuex. However, Vuex received an update for the origin list which doesn't contain the duplicated item anymore, and therefore according to Vuex state, the origin list now doesn't contain the item anymore, which is in total contradiction with what the user sees visually.
Important note
When the
group.pull
parameter is hard-set topull: 'clone'
, then everything works correctly and Vuex receives the correct items for each of the two lists.The issue described above only happens when the
pull: 'clone'
value is determined programmatically via a function.Impact
It seems that this issue causes a total impossibility for VueDraggable to provide a "duplicate-on-demand" (e.g. user presses Ctrl Key while dragging) capability. If it was not for this bug, it would be perfectly feasible.
The text was updated successfully, but these errors were encountered: