Jx.TreeItem

Extends: Object

Implements: Options, Events

An item in a tree.  An item is a leaf node that has no children.

Jx.TreeItem supports selection via the click event.  The application is responsible for changing the style of the selected item in the tree and for tracking selection if that is important.

Example

Events

clicktriggered when the tree item is clicked

Implements

EventsMooTools Class.Extras
OptionsMooTools Class.Extras

License

Copyright © 2008, DM Solutions Group Inc.

This file is licensed under an MIT style license

Summary
Jx.TreeItemExtends: Object
Properties
domObj{HTMLElement} a reference to the HTML element that is the TreeItem in the DOM
owner{Object} the folder or tree that this item belongs to
Options
label{String} the label to display for the TreeItem
data{Object} any arbitrary data to be associated with the TreeItem
contextMenu{<Jx.ContextMenu>} the context menu to trigger if there is a right click on the node
enabled{Boolean} the initial state of the TreeItem.
image{String} URL to an image to use as the icon next to the label of this TreeItem
imageClass{String} CSS class to apply to the image, useful for using CSS sprites
Constructor
Jx.TreeItemCreate a new instance of Jx.TreeItem with the associated options
Functions
finalizeClean up the TreeItem and remove all DOM references
finalizeItemClean up the TreeItem and remove all DOM references
cloneCreate a clone of the TreeItem
updateUpdate the CSS of the TreeItem’s DOM element in case it has changed position
selectedCalled when the DOM element for the TreeItem is clicked, the node is selected.
getNameGet the label associated with a TreeItem
propertyChangedA property of an object has changed, synchronize the state of the TreeItem with the state of the object

Properties

domObj

{HTMLElement} a reference to the HTML element that is the TreeItem in the DOM

owner

{Object} the folder or tree that this item belongs to

Options

label

{String} the label to display for the TreeItem

data

{Object} any arbitrary data to be associated with the TreeItem

contextMenu

{<Jx.ContextMenu>} the context menu to trigger if there is a right click on the node

enabled

{Boolean} the initial state of the TreeItem.  If the TreeItem is not enabled, it cannot be clicked.

image

{String} URL to an image to use as the icon next to the label of this TreeItem

imageClass

{String} CSS class to apply to the image, useful for using CSS sprites

Constructor

Jx.TreeItem

Create a new instance of Jx.TreeItem with the associated options

Parameters

optionsJx.TreeItem.Options

Functions

finalize

finalize: function()

Clean up the TreeItem and remove all DOM references

finalizeItem

finalizeItem: function()

Clean up the TreeItem and remove all DOM references

clone

clone : function()

Create a clone of the TreeItem

Returns

{Jx.TreeItem} a copy of the TreeItem

update

update : function(shouldDescend)

Update the CSS of the TreeItem’s DOM element in case it has changed position

Parameters

shouldDescend{Boolean} propagate changes to child nodes?

selected

selected : function(e)

Called when the DOM element for the TreeItem is clicked, the node is selected.

Parameters

e{Event} the DOM event

getName

getName : function()

Get the label associated with a TreeItem

Returns

{String} the name

propertyChanged

propertyChanged : function(obj)

A property of an object has changed, synchronize the state of the TreeItem with the state of the object

Parameters

obj{Object} the object whose state has changed
finalize: function()
Clean up the TreeItem and remove all DOM references
finalizeItem: function()
Clean up the TreeItem and remove all DOM references
clone : function()
Create a clone of the TreeItem
update : function(shouldDescend)
Update the CSS of the TreeItem’s DOM element in case it has changed position
selected : function(e)
Called when the DOM element for the TreeItem is clicked, the node is selected.
getName : function()
Get the label associated with a TreeItem
propertyChanged : function(obj)
A property of an object has changed, synchronize the state of the TreeItem with the state of the object
Create a new instance of Jx.TreeItem with the associated options