Constructordijit._tree.dndSource

dojo.require("dijit._tree.dndSource");
defined in dijit/_tree/dndSource.js

a constructor of the Source

Usage

function (/*dijit.Tree*/ tree, /*Object*/ params) (view source)
parametertypedescription
treedijit.Treethe tree widget to build the source on

This widget displays hierarchical data from a store. A query is specified to get the "top level children" from a data store, and then those items are queried for their children and so on (but lazily, as the user clicks the expand node). Thus in the default mode of operation this widget is technically a forest, not a tree, in that there can be multiple "top level children". However, if you specify label, then a special top level node (not corresponding to any item in the datastore) is created, to father all the top level children.
fieldtypedescription
.attributeMapObjectA map of attributes and attachpoints -- typically standard HTML attributes -- to set on the widget's dom, at the "domNode" attach point, by default. Other node references can be specified as properties of 'this'
.blurNodeFunctionRemoves focus from the currently focused node (which must be visible). Usually not called directly (just call focusNode() on another node instead)
.buildRenderingFunctionConstruct the UI for this widget from a template, setting this.domNode.
.checkAcceptance 
.checkItemAcceptance 
.childrenAttrone ore more attributes that holds children of a tree node
.classStringHTML class attribute
.closable 
.connectFunctionConnects specified obj/event to specified method of this object and registers for disconnect() on widget destroy. Special event: "ondijitclick" triggers on a click or enter-down or space-up Similar to dojo.connect() but takes three arguments rather than four.
.containerNodeDomNodeholds child elements. "containerNode" is generally set via a dojoAttachPoint assignment and it designates where children of the src dom node will be placed
.containerNodeTemplate 
.cookieName 
.createFunctionKick off the life-cycle of a widget
.destroyFunction 
.destroyDescendantsFunctionRecursively destroy the children of this widget and their descendants.
.destroyRecursiveFunction 
.destroyRenderingFunctionDestroys the DOM nodes associated with this widget
.dirStringUnsupported by Dijit, but here for completeness. Dijit only supports setting text direction on the entire document. Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir) attribute. Either left-to-right "ltr" or right-to-left "rtl".
.disconnectFunctionDisconnects handle created by this.connect. Also removes handle from this widget's list of connects
.dndControllerStringclass name to use as as the dnd controller
.dndParams 
.dojoAttachEvent 
.dojoAttachPoint 
.domNode 
.focusNodeFunctionFocus on the specified node (which must be visible)
.getDescendantsFunctionReturns all the widgets that contained by this, i.e., all widgets underneath this.containerNode.
.getIconClassFunctionuser overridable function to return CSS class name to display icon
.getItemChildrenFunctionUser overridable function that return array of child items of given parent item, or if parentItem==null then return top items in tree
.getLabelFunctionuser overridable function to get the label for a tree node (given the item)
.getLabelClassFunctionuser overridable function to return CSS class name to display label
.idStringa unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.
.isExpandable 
.isFocusableFunctionReturn true if this widget can currently be focused and false if not
.isLeftToRightFunctionChecks the DOM to for the text direction for bi-directional support
.isTree 
.itemCreator 
.labelStringDeprecated. Use dijit.tree.ForestStoreModel directly instead. Used in conjunction with query parameter. If a query is specified (rather than a root node id), and a label is also specified, then a fake root node is created and displayed, with this label.
.langStringRarely used. Overrides the default Dojo locale used to render this widget, as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
.lastFocused 
.layoutAlign 
.maxSize 
.mayHaveChildrenFunctionUser overridable function to tell if an item has or may have children. Controls whether or not +/- expando icon is shown. (For efficiency reasons we may not want to check if an element actually has children until user clicks the expando node)
.minSize 
.modeldijit.Tree.modelAlternate interface from store to access data (and changes to data) in the tree
.nodesWithKeyClick 
.onBlurFunctionstub function. Override or connect to this method to receive notifications for when the widget moves out of focus.
.onClickFunctionuser overridable function for executing a tree item
.onCloseFunctionCallback if someone tries to close the child, child will be closed if func returns true
.onDndCancel 
.onDndDrop 
.onFocusFunctionstub function. Override or connect to this method to receive notifications for when the widget moves into focus.
.openOnClickBooleanIf true, clicking a folder node's label will open it, rather than calling onClick()
.params 
.persistBooleanenables/disables use of cookies for state saving.
.postCreateFunction 
.postMixInPropertiesFunction 
.postscriptFunction 
.querySpecifies datastore query to return the root item for the tree. Deprecated functionality: if the query returns multiple items, the tree is given a fake root node (not corresponding to any item in the data store), whose children are the items that match this query. The root node is shown or hidden based on whether a label is specified. Having a query return multiple items is deprecated. If your store doesn't have a root item, wrap the store with dijit.tree.ForestStoreModel, and specify model=myModel
.region 
.rootNode 
.selected 
.setAttributeFunctionSet native HTML attributes reflected in the widget, such as readOnly, disabled, and maxLength in TextBox widgets.
.showRootBooleanShould the root node be displayed, or hidden?
.sizeMin 
.sizeShare 
.splitter 
.srcNodeRefDomNodepointer to original dom node
.srcNodeRef.id 
.startupFunctionCalled after a widget's children, and other widgets on the page, have been created. Provides an opportunity to manipulate any children before they are displayed. This is useful for composite widgets that need to control or layout sub-widgets. Many layout widgets can use this as a wiring phase.
.store 
.styleStringHTML style attribute
.templateNodeDomNodea node that represents the widget template. Pre-empts both templateString and templatePath.
.templatePath 
.templateStringStringa string that represents the widget template. Pre-empts the
.title 
.toStringFunction 
.tree 
.uninitializeFunctionstub function. Override to implement custom widget tear-down behavior.
.waiRole 
.waiState 
.widgetsInTemplateBooleanshould we parse the template to find widgets that might be declared in markup inside it? false by default.
._attaches 
._attachTemplateNodesFunctionIterate through the template and attach functions and nodes accordingly.
._collapseNodeFunctioncalled when the user has requested to collapse the node
._connects 
._expandNodeFunctioncalled when the user has requested to expand the node
._fillContentFunctionrelocate source contents to templated container node this.containerNode must be able to receive children, or exceptions will be thrown
._getNextNodeFunctionget next visible node
._getRootOrFirstNodeFunctionget first visible node
._itemNodeMap 
._keyHandlerMap 
._loadFunctioninitial load of the tree load root node (possibly hidden) and it's children
._ltr 
._onBlurFunctionWe've moved away from the whole tree. The currently "focused" node (see focusNode above) should remain as the lastFocused node so we can tab back into the tree. Just change CSS to get rid of the dotted border until that time
._onClickFunctiontranslates click events into commands for the controller to process
._onDownArrowFunctiondown arrow pressed; get next visible node, set focus there
._onEndKeyFunctionend pressed; go to last visible node
._onEnterKeyFunction 
._onExpandoClickFunctionuser clicked the +/- icon; expand or collapse my children.
._onFocusFunction 
._onHomeKeyFunctionhome pressed; get first visible node, set focus there
._onItemChangeFunctionset data event on an item in the store
._onItemChildrenChangeFunctionset data event on an item in the store
._onItemDeleteFunctiondelete event from the store TODO: currently this isn't called, and technically doesn't need to be, but it would help with garbage collection
._onKeyPressFunctiontranslates keypress events into commands for the controller
._onLeftArrowFunctionLeft arrow pressed. If not collapsed, collapse, else move to parent.
._onLetterKeyNavFunctionletter key pressed; search for node starting with first char = key
._onRightArrowFunctionright arrow pressed; go to child node
._onTreeFocusFunctioncalled from onFocus handler of treeitem labelNode to set styles, wai state and tabindex for currently focused treeitem.
._onUpArrowFunctionup arrow pressed; move to previous visible node
._openedItemIds 
._publishFunctionPublish a message for this widget/topic
._saveStateFunctioncreate and save a cookie with the currently expanded nodes identifiers
._skipNodeCache 
._started 
._store2modelFunctionuser specified a store&query rather than model, so create model from store/query
._stringReplFunction 
._supportingWidgets 
._v10Compat 
paramsObjecta dict of parameters, recognized parameters are:

Jump to PropertiesFunctionsBack to top

FunctioncheckAcceptance(source: Object, nodes: Array)
checks, if the target can accept nodes from this source
FunctioncheckItemAcceptance(node, source)
stub funciton to be overridden if one wants to check for the ability to drop at the node/item level
FunctioncopyState(keyPressed: Boolean)
Returns true, if we need to copy items, false to move. It is separated to be overwritten dynamically, if needed.
prepares the object to be garbage-collected
returns a data item by its key (id) console.log("Container getItem()", arguments,this.map, this.map[key], this.selection[key]);
FunctioninsertItems(item, parent)
inserts new data items (see Container's insertNodes method for details) we actually need to add things to the store here instead of adding noes to the tree directly
FunctionitemCreator(nodes)
FunctionmarkupFactory(params, node)
topic event processor for /dnd/cancel, called to cancel the DnD operation
FunctiononDndDrop(source: Object, nodes: Array, copy: Boolean)
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.
topic event processor for /dnd/source/over, called when detected a current source
FunctiononDndStart(source: Object, nodes: Array, copy: Boolean)
topic event processor for /dnd/start, called to initiate the DnD operation
event processor for onmousedown
event processor for onmousemove
event processor for onmouseout
event processor for onmouseover
event processor for onmouseup
this function is called once, when mouse is out of our container
this function is called once, when mouse is over our container
unselects all items
Function_addItemClass(node: Node, type: String)
adds a class with prefix "dojoDndItem"
Function_changeState(type: String, newState: String)
changes a named state to new state value
gets a child, which is under the mouse at the moment, or null
changes source's state based on "copy" status
assigns a class to the current target anchor based on "before" status
removes a class with prefix "dojoDndItem"
unselects all items
removes a class of the current target anchor based on "before" status

Jump to FunctionsPropertiesBack to top

list of accepted types (text strings) for a target; assumed to be ["text"] if omitted horizontal: Boolean: a horizontal container, if true, vertical otherwise or when omitted copyOnly: Boolean: always copy items, if true, use a state of Ctrl key otherwise skipForm: Boolean: don't start the drag operation, if clicked on form elements the rest of parameters are passed to the selector
can be used as a DnD source, if true; assumed to be "true" if omitted
node or node's id to build the container on