Closed hybridwebdev closed 4 years ago
no, it doesn't support this case.
I got it.
Firstly, you need fix the https://github.com/phphe/vue-draggable-nested-tree/issues/38
Then add information about target in drop event (DraggableTreeNode.vue), appendTo and targetTree:
drop: (e, opt, store) => {
const draggableHelperInfo = {
event: e, options: opt, store,
appendTo: dplh._vm.$parent.data,
targetTree: dplh._vm.store
}
And just hook ondragend
in your code, return false and push pure copy of element into target:
ondragend(node, draggableHelperInfo) {
if(!draggableHelperInfo.appendTo.hasOwnProperty('children'))
draggableHelperInfo.appendTo['children']=[];
draggableHelperInfo.appendTo.children.push(draggableHelperInfo.targetTree.pure(node, true));
return false;
}
i realize that in https://github.com/FlameArtLab/vue-draggable-nested-tree/commit/a11ff522ba008d3c0bc6dd954e144635f3859a8d
This solution visually worse, than clone in Nested Sortable for jquery, and it only append, but it worked good and you can use insertAfter\Before in ur code for precise positioning
I think ondragstart is better for clone. The feature will make it more complex. I may add it in the future.
so now in version 2.2.17 ,how can i clone node and drag?
still not support
so now in version 2.2.17 ,how can i clone node and drag?
still not support
Hi! still not support?
This is supported in new repo: he-tree-vue https://he-tree-vue.phphe.com/api.html#clonewhendrag vue-draggable-nested-tree don't support this, and it is no longer be maintained
Well thank you!
Sorry, I checked the examples, and can't see any parameter that allows for an element to be cloned on drag. Is this a possibility?