Handles drag and drop operations (as a source or a target) for dijit.Tree
Parameter | Type | Description |
---|---|---|
tree | dijit/Tree | |
params | dijit/tree/dndSource |
See the dijit/tree/dndSource reference documentation for more information.
List of accepted types (text strings) for the Tree; defaults to ["text"]
Distance from upper/lower edge of node to allow drop to reorder nodes
The currently hovered TreeNode. Not set to anything for keyboard operation. (TODO: change?)
The move delay in pixels before detecting a drag; 5 by default
(id to DomNode) map for every TreeNode that's currently selected. The DOMNode is the TreeNode.rowNode.
Allows selection of only one element, if true. Tree hasn't been tested in singular=true mode, unclear if it works.
Adds a class with prefix "dojoDndItem"
Parameter | Type | Description |
---|---|---|
node | Node | A node |
type | String | A variable suffix for a class name |
Changes a named state to new state value
Parameter | Type | Description |
---|---|---|
type | String | A name of the state to change |
newState | String | new state |
Parameter | Type | Description |
---|---|---|
n1 | undefined | |
n2 | undefined |
Checks whether the dragged items are parent rows in the tree which are being dragged into their own children.
Parameter | Type | Description |
---|---|---|
source | undefined | The DragSource object. |
targetRow | undefined | The tree row onto which the dragged nodes are being dropped. |
Changes source's state based on "copy" status
Parameter | Type | Description |
---|---|---|
copy | undefined |
Removes a class with prefix "dojoDndItem"
Parameter | Type | Description |
---|---|---|
node | Node | A node |
type | String | extension |
Returns a copy of xs which lacks any objects occurring in ys. Checks for membership by modifying and then reading the object, so it will not properly handle sets of numbers or strings.
Parameter | Type | Description |
---|---|---|
xs | undefined | |
ys | undefined |
Removes hover class of the current target anchor
Update the following tree properties from the current selection: path[s], selectedItem[s], selectedNode[s]
add node to current selection
Parameter | Type | Description |
---|---|---|
node | Node | node to add |
isAnchor | Boolean |
Optional Whether the node should become anchor. |
node to add
Checks if the target can accept nodes from this source
Parameter | Type | Description |
---|---|---|
source | dijit/tree/dndSource | The source which provides items |
nodes | DOMNode[] | Array of DOM nodes corresponding to nodes being dropped, dijitTreeRow nodes if source is a dijit/Tree. |
Stub function to be overridden if one wants to check for the ability to drop at the node/item level
In the base case, this is called to check if target can become a child of source. When betweenThreshold is set, position="before" or "after" means that we are asking if the source node can be dropped before/after the target node.
Parameter | Type | Description |
---|---|---|
target | DOMNode | The dijitTreeRoot DOM node inside of the TreeNode that we are dropping on to Use dijit.getEnclosingWidget(target) to get the TreeNode. |
source | dijit/tree/dndSource | The (set of) nodes we are dropping |
position | String | "over", "before", or "after" |
Returns true, if we need to copy items, false to move. It is separated to be overwritten dynamically, if needed.
Parameter | Type | Description |
---|---|---|
keyPressed | Boolean | The "copy" control key was pressed |
Iterates over selected items;
see dojo/dnd/Container.forInItems()
for details
Parameter | Type | Description |
---|---|---|
f | Function | |
o | Object |
Optional
|
Returns the dojo/dnd/Container._Item (representing a dragged node) by it's key (id). Called by dojo/dnd/Source.checkAcceptance().
Parameter | Type | Description |
---|---|---|
key | String |
Returns a list of selected node(s). Used by dndSource on the start of a drag.
return true if node is currently selected
Parameter | Type | Description |
---|---|---|
node | Node | the node to check whether it's in the current selection |
Returns objects passed to Tree.model.newItem()
based on DnD nodes
dropped onto the tree. Developer must override this method to enable
dropping from external sources onto this Tree, unless the Tree.model's items
happen to look like {id: 123, name: "Apple" } with no other attributes.
For each node in nodes[], which came from source, create a hash of name/value pairs to be passed to Tree.model.newItem(). Returns array of those hashes.
Parameter | Type | Description |
---|---|---|
nodes | DomNode[] | |
target | DomNode | |
source | dojo/dnd/Source |
Array of name/value hashes for each new item to be added to the Tree
remove node and it's descendants from current selection
Parameter | Type | Description |
---|---|---|
node | Node | node to remove |
node to remove
set the list of selected nodes to be exactly newSelection. All changes to the selection should be passed through this function, which ensures that derived attributes are kept up to date. Anchor will be deleted if it has been removed from the selection, but no new anchor will be added by this function.
Parameter | Type | Description |
---|---|---|
newSelection | Node[] | list of tree nodes to make selected |
Add or remove the given node from selection, responding to a user action such as a click or keypress.
Parameter | Type | Description |
---|---|---|
node | undefined | |
multi | Boolean | Indicates whether this is meant to be a multi-select action (e.g. ctrl-click) |
range | Boolean | Indicates whether this is meant to be a ranged action (e.g. shift-click) |
Helper method for processing onmousemove/onmouseover events while drag is in progress. Keeps track of current drop target.
Parameter | Type | Description |
---|---|---|
e | Event | The mousemove event. |
firstTime | Boolean |
Optional If this flag is set, this is the first mouse move event of the drag, so call m.canDrop() etc. even if newTarget == null because the user quickly dragged a node in the Tree to a position over Tree.containerNode but not over any TreeNode (#7971) |
Event processor for onmousedown/ontouchstart/onkeydown corresponding to a click event
Parameter | Type | Description |
---|---|---|
e | Event | onmousedown/ontouchstart/onkeydown event |
Event processor for onmouseup/ontouchend/onkeyup corresponding to a click event
Parameter | Type | Description |
---|---|---|
e | Event | onmouseup/ontouchend/onkeyup event |
Topic event processor for /dnd/cancel, called to cancel the DnD operation
Topic event processor for /dnd/drop, called to finish the DnD operation.
Updates data store items according to where node was dragged from and dropped to. The tree will then respond to those data store updates and redraw itself.
Parameter | Type | Description |
---|---|---|
source | Object | The dijit/tree/dndSource / dojo/dnd/Source which is providing the items |
nodes | DomNode[] | The list of transferred items, dndTreeNode nodes if dragging from a Tree |
copy | Boolean | Copy items, if true, move items otherwise |
Topic event processor for /dnd/source/over, called when detected a current source.
Parameter | Type | Description |
---|---|---|
source | Object | The dijit/tree/dndSource / dojo/dnd/Source which has the mouse over it |
Topic event processor for /dnd/start, called to initiate the DnD operation
Parameter | Type | Description |
---|---|---|
source | Object | The dijit/tree/dndSource / dojo/dnd/Source which is providing the items |
nodes | DomNode[] | The list of transferred items, dndTreeNode nodes if dragging from a Tree |
copy | Boolean | Copy items, if true, move items otherwise |
Event processor for onmousedown/ontouchstart
Parameter | Type | Description |
---|---|---|
e | Event | onmousedown/ontouchend event |
Called for any onmousemove/ontouchmove events over the Tree
Parameter | Type | Description |
---|---|---|
e | Event | onmousemouse/ontouchmove event |
Event processor for when mouse is moved away from a TreeNode
Called when mouse is moved over a TreeNode
Parameter | Type | Description |
---|---|---|
widget | TreeNode | |
evt | Event |
Event processor for onmouseup/ontouchend
Parameter | Type | Description |
---|---|---|
e | Event | onmouseup/ontouchend event |
This method is called when mouse is moved out of our container (like onmouseleave)
This method is called when mouse is moved over our container (like onmouseenter)