phphe / vue-draggable-nested-tree

Vue2 draggable tree component
https://hetree.phphe.com/
MIT License
344 stars 62 forks source link

Make only parent undraggable #98

Open wdamaral opened 4 years ago

wdamaral commented 4 years ago

Is there any way to make only the parent node undraggable? I noticed that if I put draggable = false on the parent node, all of its children also become undraggable.

-Parent (draggable = false)

steeldimon commented 4 years ago

i'm release something what you mean, with lazy loading tree When i'm get root element with children, then set data.draggable = false After all: loadChildren(slotProps) { var data = slotProps.data if (!data.children.length) { data.children.forEach(function (child) { axios.get(`http://127.0.0.1:8000/dashboard/object/${child.id}`) .then( function (response) { response.data.open = false // current level = 1 (0) // all child make draggable if (slotProps.vm.level > 0) { response.data.draggable = true } data.children.push(response.data) }) .catch(error => console.log(error)) }); } } }