dijit/tree/_dndSelector (version 1.10)

dijit/tree/_dndContainer

Summary

This is a base class for dijit/tree/dndSource, and isn't meant to be used directly. It's based on dojo/dnd/Selector.

Usage

var foo = new _dndSelector();
dijit/tree/_dndSelector

See the dijit/tree/_dndSelector reference documentation for more information.

Property Summary

  • currentThe currently hovered TreeNode.
  • selection(id to DomNode) map for every TreeNode that's currently selected.
  • singularAllows selection of only one element, if true.

Method Summary

  • _addItemClass(node,type) Adds a class with prefix "dojoDndItem"
  • _changeState(type,newState) Changes a named state to new state value
  • _compareNodes(n1,n2)
  • _removeItemClass(node,type) Removes a class with prefix "dojoDndItem"
  • _setDifference(xs,ys) Returns a copy of xs which lacks any objects occurring in ys.
  • _updateSelectionProperties() Update the following tree properties from the current selection: path[s], selectedItem[s], selectedNode[s]
  • addTreeNode(node,isAnchor) add node to current selection
  • destroy() Prepares the object to be garbage-collected
  • forInSelectedItems(f,o) Iterates over selected items; see dojo/dnd/Container.forInItems() for details
  • getItem(key) Returns the dojo/dnd/Container._Item (representing a dragged node) by it's key (id).
  • getSelectedTreeNodes() Returns a list of selected node(s).
  • isTreeNodeSelected(node) return true if node is currently selected
  • removeTreeNode(node) remove node and it's descendants from current selection
  • selectNone() Unselects all items
  • setSelection(newSelection) set the list of selected nodes to be exactly newSelection.
  • userSelect(node,multi,range) Add or remove the given node from selection, responding to a user action such as a click or keypress.

Event Summary

  • onClickPress(e) Event processor for onmousedown/ontouchstart/onkeydown corresponding to a click event
  • onClickRelease(e) Event processor for onmouseup/ontouchend/onkeyup corresponding to a click event
  • onMouseDown() Event processor for onmousedown/ontouchstart
  • onMouseMove(e) event processor for onmousemove/ontouchmove
  • onMouseOut(widget,evt) Called when mouse is moved away from a TreeNode
  • onMouseOver(widget,evt) Called when mouse is moved over a TreeNode
  • onMouseUp() Event processor for onmouseup/ontouchend
  • onOutEvent() This function is called once, when mouse is out of our container
  • onOverEvent() This function is called once, when mouse is over our container

Properties

current

The currently hovered TreeNode. Not set to anything for keyboard operation. (TODO: change?)

selection

(id to DomNode) map for every TreeNode that's currently selected. The DOMNode is the TreeNode.rowNode.

singular

Allows selection of only one element, if true. Tree hasn't been tested in singular=true mode, unclear if it works.

Methods

_addItemClass(node,type)

Adds a class with prefix "dojoDndItem"

Parameter Type Description
node Node

A node

type String

A variable suffix for a class name

_changeState(type,newState)

Changes a named state to new state value

Parameter Type Description
type String

A name of the state to change

newState String

new state

_compareNodes(n1,n2)
Parameter Type Description
n1 undefined
n2 undefined
Returns:number | undefined
_removeItemClass(node,type)

Removes a class with prefix "dojoDndItem"

Parameter Type Description
node Node

A node

type String

extension

_setDifference(xs,ys)

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
Returns:undefined
_updateSelectionProperties()

Update the following tree properties from the current selection: path[s], selectedItem[s], selectedNode[s]

addTreeNode(node,isAnchor)

add node to current selection

Parameter Type Description
node Node

node to add

isAnchor Boolean
Optional

Whether the node should become anchor.

Returns:Node

node to add

destroy()

Prepares the object to be garbage-collected

forInSelectedItems(f,o)

Iterates over selected items; see dojo/dnd/Container.forInItems() for details

Parameter Type Description
f Function
o Object
Optional
getItem(key)

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:object
getSelectedTreeNodes()

Returns a list of selected node(s). Used by dndSource on the start of a drag.

Returns:Array
isTreeNodeSelected(node)

return true if node is currently selected

Parameter Type Description
node Node

the node to check whether it's in the current selection

Returns:undefined
removeTreeNode(node)

remove node and it's descendants from current selection

Parameter Type Description
node Node

node to remove

Returns:Node

node to remove

selectNone()

Unselects all items

Returns:function

Unselects all items

setSelection(newSelection)

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

userSelect(node,multi,range)

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)

Events

onClickPress(e)

Event processor for onmousedown/ontouchstart/onkeydown corresponding to a click event

Parameter Type Description
e Event

onmousedown/ontouchstart/onkeydown event

onClickRelease(e)

Event processor for onmouseup/ontouchend/onkeyup corresponding to a click event

Parameter Type Description
e Event

onmouseup/ontouchend/onkeyup event

onMouseDown()

Event processor for onmousedown/ontouchstart

onMouseMove(e)

event processor for onmousemove/ontouchmove

Parameter Type Description
e Event

onmouseup/ontouchend event

onMouseOut(widget,evt)

Called when mouse is moved away from a TreeNode

Parameter Type Description
widget TreeNode
evt Event
onMouseOver(widget,evt)

Called when mouse is moved over a TreeNode

Parameter Type Description
widget TreeNode
evt Event
onMouseUp()

Event processor for onmouseup/ontouchend

onOutEvent()

This function is called once, when mouse is out of our container

onOverEvent()

This function is called once, when mouse is over our container

Error in the documentation? Can’t find what you are looking for? Let us know!