vue-draggable-nested-tree icon indicating copy to clipboard operation
vue-draggable-nested-tree copied to clipboard

Is there a way to prevent the placeholder appearing when dragging into root level?

Open flight9 opened this issue 7 years ago • 5 comments
trafficstars

Our project have a constraint that there should only be one node at the root level. So we use following codes to prevent that happening, it works:

dragEndHook(node) {
  return !node._vm.store.dplh.parent.isRoot; // return false to stop dropping
}

But we found the placeHolder still appears at root level, that may mislead our users by let them think the root level is permitted for node to be dropped. Is there a way to prevent the placeholder appearing?

version: vue-draggable-nested-tree 2.1.6

flight9 avatar Sep 12 '18 02:09 flight9

set rootnode.droppable = false

phphe avatar Sep 12 '18 02:09 phphe

@phphe I overwitten the dragstart hook with following codes, but the placeHolder still appears at root level.

    dragStartHook(node) {
      const rootNode = node._vm.store.rootData; // guess I got rootNode correctly
      this.$set(rootNode, 'droppable', false);
    },

Before dragging: before-test2-rootlevel-2122534351

While dragging: after-test2-rootlevel-2122252536

flight9 avatar Sep 12 '18 04:09 flight9

this is a bug. rootnode can't be set droppable false now. i will try to resolve it.

phphe avatar Sep 12 '18 06:09 phphe

@phphe thanks for confirming

flight9 avatar Sep 12 '18 06:09 flight9

latest 2.1.7 should solve that

phphe avatar Nov 04 '18 15:11 phphe