# Yahoo! UI Library

### TreeView Widget 2.8.2r1

Yahoo! UI Library > treeview > YAHOO.widget.TextNode
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.TextNode - extends YAHOO.widget.Node

Known Subclasses:
  YAHOO.widget.MenuNode YAHOO.widget.DateNode

The default node presentation. The first parameter should be either a string that will be used as the node's label, or an object that has at least a string property called label. By default, clicking the label will toggle the expanded/collapsed state of the node. By setting the href property of the instance, this behavior can be changed so that the label will go to the specified href.

### Constructor

YAHOO.widget.TextNode `( oData , oParent , expanded )`

Parameters:
  `oData <object>` a string or object containing the data that will be used to render this node. Providing a string is the same as providing an object with a single property named label. All values in the oData will be used to set equally named properties in the node as long as the node does have such properties, they are not undefined, private or functions. All attributes are made available in noderef.data, which can be used to store custom attributes. TreeView.getNode(s)ByProperty can be used to retrieve a node by one of the attributes.
  `oParent <YAHOO.widget.Node>` this node's parent node
  `expanded <boolean>` the initial expanded/collapsed state (deprecated; use oData.expanded)

### Properties

#### _type - `private string`

The node type
Default Value: "TextNode"

#### href - `string`

The href for the node's label. If one is not specified, the href will be set so that it toggles the node.

#### label - `string`

The text for the label. It is assumed that the oData parameter will either be a string that will be used as the label, or an object that has a property called "label" that we will use.

#### labelElId - `string`

The derived element id of the label for this node

#### labelStyle - `string`

The CSS class for the label href. Defaults to ygtvlabel, but can be overridden to provide a custom presentation for a specific node.

#### target - `string`

The label href target, defaults to current window

#### title - `string`

The text for the title (tooltip) for the label element

#### Properties inherited from YAHOO.widget.Node:

`_dynLoad, _focusedItem, _focusHighlightedItems, _type, children, childrenRendered, className, contentElId, contentStyle, data, dataLoader, depth, dynamicLoadComplete, editable, enableHighlight, expanded, hasIcon, highlightState, iconMode, index, isLeaf, isLoading, multiExpand, nextSibling, nowrap, parent, previousSibling, propagateHighlightDown, propagateHighlightUp, renderHidden, tree`

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### destroyEditorContents

`void destroyEditorContents ( editorData )`
Destroys the contents of the inline editor panel. Overrides Node.destroyEditorContent. Since we didn't set any event listeners on this inline editor, it is more efficient to avoid the generic method in Node.

Parameters:
  `editorData <YAHOO.widget.TreeView.editorData>` a shortcut to the static object holding editing information

#### displayEditedValue

`void displayEditedValue ( value , editorData )`
Finally displays the newly edited value in the tree. Overrides Node.displayEditedValue.

Parameters:
  `value <string>` value to be displayed and stored in the node
  `editorData <YAHOO.widget.TreeView.editorData>` a shortcut to the static object holding editing information

#### fillEditorContainer

`fillEditorContainer ( editorData )`
Places an <input> textbox in the input container and loads the label text into it.

Parameters:
  `editorData <YAHOO.widget.TreeView.editorData>` a shortcut to the static object holding editing information

Returns: ``
  void

#### getEditorValue

`string getEditorValue ( editorData )`
Returns the value from the input element. Overrides Node.getEditorValue.

Parameters:
  `editorData <YAHOO.widget.TreeView.editorData>` a shortcut to the static object holding editing information

Returns: `string`
  value entered

#### getLabelEl

`object getLabelEl ( )`
Returns the label element

Returns: `object`
  the element

#### getNodeDefinition

`Object | false getNodeDefinition ( )`
Returns an object which could be used to build a tree out of this node and its children. It can be passed to the tree constructor to reproduce this node as a tree. It will return false if the node or any descendant loads dynamically, regardless of whether it is loaded or not.

Returns: `Object | false`
  definition of the tree or false if this node or any descendant is defined as dynamic

#### setUpLabel

`void setUpLabel ( oData )`
Sets up the node label

Parameters:
  `oData <object>` string containing the label, or an object with a label property

#### Methods inherited from YAHOO.widget.Node:

`_canHaveFocus, _childrenHighlighted, _removeFocus, _setHighlightClassName, appendChild, appendTo, applyParent, collapse, collapseAll, completeRender, destroyEditorContents, displayEditedValue, editNode, expand, expandAll, fillEditorContainer, focus, getAncestor, getChildrenEl, getChildrenElId, getChildrenHtml, getContentEl, getContentHtml, getDepthStyle, getEditorValue, getEl, getElId, getHoverStyle, getHtml, getIconMode, getNodeCount, getNodeDefinition, getNodeHtml, getSiblings, getStyle, getToggleEl, getToggleElId, getToggleLink, hasChildren, hideChildren, highlight, init, insertAfter, insertBefore, isChildOf, isDynamic, isRoot, loadComplete, refresh, renderChildren, saveEditorValue, setDynamicLoad, setNodesProperty, showChildren, toggle, toggleHighlight, toString, unhighlight`

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

#### Events inherited from YAHOO.widget.Node:

`parentChange,`

Copyright © 2010 Yahoo! Inc. All rights reserved.