-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag&Drop 2.0 #55
Comments
Now the real magic is going to happen. |
Can you share the code via jsfiddle? I will check it |
I'm sorry, but providing a fiddle is a bit tedious. |
I didn't clone your repo. But it should fix your issue. |
Much appreciated 👍 |
Does my fix helped? :) |
No sorry it didn't fix it. |
Since this issue might be features related, I though I might as well add some ideas (upcoming features) that could be added.
Maybe you or anybody else can fill in. |
|
Sorry I'm asking so many questions, but I'm already integrating this plugin into our company's application and there is so much to know. |
|
Is there any kind of reason behind not showing or do you still have something not done yet ?
I was gonna talk to you about the checkbox as well. |
Hi, amsik, I have isse with dnd when I drop the node the node parent is null, but I need to get the parent node data for further databas operations. BR |
Hi how i can get the destination ? |
Hi. You have 2 ways to get the destination:
const opts = {
dnd: {
onDragStart(node) {
console.log('onDragStart', node.text)
},
onDragOn(targetNode, destinationNode) {
console.log('onDragOn', targetNode.text, destinationNode.text)
return true
},
onDragFinish(targetNode, destinationNode) {
console.log('onDragFinish', targetNode.text, destinationNode.text)
return true
}
}
} |
Thank you for your answers, but I wanted to know if we could have the whole destination. Example: Parent1/Parent2/Child |
Hi, i just calculated the target node, and call afterDragfinish method where i finish all of the after drag tasks: logDragFinish(node) { |
Sorry for asking, but is there a way to know the new target's position? For example if I have two nodes
There is no way to know where the target node is :( EDIT: Nevermind, I found by reading the source code that |
See amsik#55 (comment), thanks.
Hi! Destination node must be. Either target node added inside or beside. You have the 3th argument to detect the drop position. |
Yes I used the 3rd argument to know the drop position, it helped me a lot. |
How to implement multiple dragging? Anyone help? please.... |
What do you mean by multiple dragging? |
For example.... select several nodes, then drag all nodes to another position of tree. |
Hey, Thank you for all the work that went into the library. I am currently facing the problem that i do want to use drag an drop, but there are certain limitations. Would it be possible to implement some sort of mechanism that decides if the dnd should be reversed depending on the outcome of a method? This method would in my case contain the call to the backend. As the data prop is not reactive too, otherwise I'd have to reverse the decision manually by some stored state, and then rerender the whole tree. |
Hey, It possible.
|
You are right, I had not seen that. |
I can't get this to work. Whenever I use I found a way arround it... but now it always duplicates the node I pass into Your documentation even states that a new Node will be created but that is not what I want. I want to be able to "reverse/undo" the moved node back to its original position. |
For anyone coming here wanting to "Move a node after an async operation", take a look at my code below. onDragFinish(targetNode, destinationNode, dropPosition) {
// make a copy of target node
const clonedTargetNode = clone(targetNode)
// setup your API payload
const payload = {
id: clonedTargetNode.data.id,
parentID: destinationNode.data.id
};
// send payload off and wait for a response
this.$store.dispatch('module/actionName', payload)
.then(response => {
// on success
// remove the original node
targetNode.remove()
// add cloned node to destination
destinationNode.append(clonedTargetNode)
})
.catch(error => {
// on error, do nothing... maybe show an error
console.info('error occurred', error)
})
// prevents LiquorTree from moving the item
return false
}, |
Hi @amsik and first of all, thanks for your work ! I have a question about the feature "Ability to Drag to others tree". Are you still planning to develop it ? Thanks for your reply ! |
Hi @amsik I have an issue with the drag and drop feature. |
Dragging and dropping doesn't seem to change the data... does that need to be implemented manually? I'm looking for two-way binding like shown here: https://sortablejs.github.io/Vue.Draggable/#/nested-example (Notice how the list on the right also changes as you drag nodes around.) |
Now there is only basic functionality of DND includes events (dragging:start, dragging:finish)
Plans:
states
likedraggable
,dropable
The text was updated successfully, but these errors were encountered: