-
-
Notifications
You must be signed in to change notification settings - Fork 604
-
-
Notifications
You must be signed in to change notification settings - Fork 604
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 n drop multiple Nodes and folder #146
Comments
This is no official 'feature' yet, but you could already call tree.getSelectedNodes() in the drop handler and then move, copy, or whatever these nodes to the target, I guess. |
+1 |
Hi, |
Hi Martin, |
@djangosdk no, it hasn't yet. |
Dear @mar10 |
+1 |
There is no built-in 'multiDnd' option, because the potential use cases are too diverse. |
Is it possible to have multi-dnd without checkbox? I'd like to select multiple tree nodes by using ctrl key, it feels more user friendly Thanks. |
Sure, the sample just looks at the 'selected' state, which can be set using |
Wow, this is the most thorough demo I've seen for multi-select nested tree. Very nice work, especially on the drag cursor which shows how many items are selected. Brilliant! Two questions:
|
Made a bit of progress here: dragDrop: function(node, data) {
...
var canDrop = node.span.classList.value.includes('fancytree-folder');
if (canDrop) {o.moveTo(node, data.hitMode);} Now I can only drag inside folders (hooray!). Currently trying to figure out how to get that little indicator (drop vs non-drop) to cooperate |
Looks like I was able to figure this out. Just needed to define my own logic of what can be accepted Patched dnd.js as follows and my first task is done: var acceptable = accept === true && $target.hasClass('fancytree-folder')
instData.$dropMarker
.toggleClass(classDropAfter, hitMode === "after")
.toggleClass(classDropOver, hitMode === "over")
.toggleClass(classDropBefore, hitMode === "before")
.position($.ui.fancytree.fixPositionOptions({
my: "left" + offsetString(markerOffsetX) + " center",
at: "left " + markerAt,
of: $targetTitle
}));
if (acceptable) { instData.$dropMarker.show(); }
if( $source ){
$source
.toggleClass(classDropAccept, acceptable === true)
.toggleClass(classDropReject, acceptable === false);
}
$target
.toggleClass(classDropTarget, (hitMode === "after" || hitMode === "before" || hitMode === "over") && acceptable)
.toggleClass(classDropAfter, hitMode === "after")
.toggleClass(classDropBefore, hitMode === "before")
.toggleClass(classDropAccept, acceptable === true)
.toggleClass(classDropReject, acceptable === false);
helper
.toggleClass(classDropAccept, acceptable === true)
.toggleClass(classDropReject, acceptable === false); |
So I only have one pending question here: Linking multiple lists. I need my second list to be sortable and one thing I do notice in the original example you provided is that I am unable to drag items into custom order, even though I get the indicator that it's possible. How do I fix this? |
Hi,
Use the API instead: dragStart: function(node, data) {
// This function MUST be defined to enable dragging for the tree.
// Return false to cancel dragging of node.
return node.isFolder();
}, Basically you can control drag/drop completely by implementing the (sample-multi-dnd.html only demos how to tweak the helper image, and use all selected nodes instead of the currently active one.) |
That is very helpful. Thanks a lot! |
for reference (as google search is leading here), this is the tutorial to follow now : https://github.com/mar10/fancytree/wiki/ExtDnd5 |
Hello,
How can I activate dragging of multiple nodes. was it not supposed to be a feature in fancytree ?
This feature is provided in Jstree and works well within and between different trees.
Am I missing example somewhere ?
The text was updated successfully, but these errors were encountered: