API: treeview YAHOO.widget.HTMLNode (YUI Library)

# Yahoo! UI Library

### TreeView Widget 2.9.0

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

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

This implementation takes either a string or object for the oData argument. If is it a string, it will use it for the display of this node (and it can contain any html code). If the parameter is an object,it looks for a parameter called "html" that will be used for this node's display.

### Constructor

YAHOO.widget.HTMLNode `( oData , oParent , expanded , hasIcon )`

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 html. 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 other 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)
  `hasIcon <boolean>` specifies whether or not leaf nodes should be rendered with or without a horizontal line and/or toggle icon. If the icon is not displayed, the content fills the space it would have occupied. This option operates independently of the leaf node presentation logic for dynamic nodes. (deprecated; use oData.hasIcon)

### Properties

#### _deferredNodes - `private static YAHOO.widget.HTMLNode[]`

An array of HTMLNodes created with HTML Elements that had their rendering deferred until the basic tree structure is rendered.
Default Value: []

#### _timer - `private static System Timer`

A system timer value used to mark whether a deferred operation is pending.
Default Value: null

#### _type - `private string`

The node type
Default Value: "HTMLNode"

#### contentStyle - `string`

The CSS class for the html content container. Defaults to ygtvhtml, but can be overridden to provide a custom presentation for a specific node.

#### html - `string`

The HTML content to use for this node's display

#### 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

#### 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 any node loads dynamically, regardless of whether it is loaded or not.

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

#### initContent

`void initContent ( oData , hasIcon )`
Sets up the node label

Parameters:
  `oData <object>` An html string or object containing an html property
  `hasIcon <boolean>` determines if the node will be rendered with an icon or not

#### setHtml

`void setHtml ( o )`
Synchronizes the node.html, and the node's content

Parameters:
  `o <object |string | HTMLElement >` An html string, an object containing an html property or an HTML element

#### 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 © 2011 Yahoo! Inc. All rights reserved.