This object provides some useful methods for working with arrays.
arrayHelper
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Description | ||||||||||||
indexOfSyntax
Arguments
Return Type
|
Returns the index of an object in an array. If the object is
not present in the array this returns -1
| ||||||||||||
insertBeforeSyntax
Arguments
Return Type
| Inserts an object before another object in an array. (The length increases by 1). | ||||||||||||
removeSyntax
Arguments
Return Type
| This removes the first instance of an object from an array (the length decreases with 1). |
| Name | Type | Descripton |
| None. | ||
| Name | Descripton |
| None. | |
None.
This class extends
WebFXTreeAbstractNode
and therefore all methods and field available for
WebFXTreeAbstractNode
are also available for WebFXTree.
This is the root object of xTree and it is where everything begins.
Create a WebFXTree object and then use
add to add
WebFXTreeItem objects to it.
new WebFXTree(sText, oAction, sBehavior, sIcon, sOpenIcon)
| Name | Type | Descripton |
sText | | The text (HTML) to show as a label for the tree item |
oAction | | The action to do when the node is activated. If this is String then it is treated as an URL but you can also pass a Function object which will be called when activated. |
sBehavior | | This is used to decide when to show the open icon for folders. Supported values are "classic" and "explorer". When this is "explorer" selected folders show the open icon. For "classic" the open icon is shown for expanded folders. |
sIcon | | The image to use as icon |
sOpenIcon | | The image to use as open icon |
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Description | ||||||
getBehaviorSyntax
Arguments
Return Type
| Returns the behavtion (classic or explorer) that is currently describing the open folder strategy. | ||||||
getSelectedSyntax
Arguments
Return Type
| The currently selected tree node in the tree. | ||||||
getShowExpandIconsSyntax
Arguments
Return Type
| Whether to show the expand (plus/minus) icons | ||||||
getShowLinesSyntax
Arguments
Return Type
| Whether to show the lines in the tree | ||||||
getShowRootLinesSyntax
Arguments
Return Type
| Whether to show the lines for the tree on the root level | ||||||
getShowRootNodeSyntax
Arguments
Return Type
| Whether to show the root node or not. Hiding the root node allows you to create a tree that looks like it has multiple roots. | ||||||
getSuspendRedrawSyntax
Arguments
Return Type
| Whether redraws of the tree is suspended. Suspending redraws can be useful if a lot of changes are done to it which would each require a redraw. | ||||||
onchangeSyntax
Arguments
Return Type
| This method is called when the selected item is changed. Override this to provide custom handling for onchange. | ||||||
setBehaviorSyntax
Arguments
Return Type
| Sets the behavior for the tree. The behavior describes when to use the open icon for tree items. | ||||||
setSelectedSyntax
Arguments
Return Type
| Sets the selected node in the tree | ||||||
setShowExpandIconsSyntax
Arguments
Return Type
| Sets whether to show the expand (plus/minus) icons | ||||||
setShowLinesSyntax
Arguments
Return Type
| Sets whether to show or hide the lines in the tree | ||||||
setShowRoootNodeSyntax
Arguments
Return Type
| Sets whether to show or hide the root node. | ||||||
setShowRootLinesSyntax
Arguments
Return Type
| Sets whether the root level lines should be drawn for the tree. | ||||||
setSuspendRedrawSyntax
Arguments
Return Type
| Whether to suspend redraws of the tree. | ||||||
writeSyntax
Arguments
Return Type
|
Does a document.write() of the HTML needed to draw
the tree.
|
| Name | Type | Descripton |
| None. | ||
| Name | Descripton |
| None. | |
This is the abstract base class for the nodes building up the tree.
new WebFXTreeAbstractNode(sText, oAction)
| Name | Type | Descripton |
sText | | The HTML text to show as the label of the node |
oAction | | The action to do when the node is activated. If this is String then it is treated as an URL but you can also pass a Function object which will be called when activated. |
| Name | Description |
| Name | Type | Descripton |
| None. | ||
| Name | Description | ||||||||||||
addSyntax
Arguments
Return Type
| Adds a node as a child to the current node. | ||||||||||||
collapseSyntax
Arguments
Return Type
| Collapses the node | ||||||||||||
collapseAllSyntax
Arguments
Return Type
| Collapses the node and all its descendants | ||||||||||||
collapseChildrenSyntax
Arguments
Return Type
| Collapse all the descendants of the node | ||||||||||||
containsSyntax
Arguments
Return Type
| Whether this node contains another node. A node contains itself so if the argument is the same node this will return true. | ||||||||||||
createSyntax
Arguments
Return Type
| Creates the DOM element representing the node. This element can then be inserted into the document. | ||||||||||||
deselectSyntax
Arguments
Return Type
| Deselect the node | ||||||||||||
disposeSyntax
Arguments
Return Type
| This cleans up the objects. After the node has been disposed it cannot be used any more. | ||||||||||||
expandSyntax
Arguments
Return Type
| Expands the node | ||||||||||||
expandAllSyntax
Arguments
Return Type
| Expands the node and all its descendants | ||||||||||||
expandChildrenSyntax
Arguments
Return Type
| Expands all the descendants of the node | ||||||||||||
findChildByTextSyntax
Arguments
Return Type
| Returns the child with the given text. The second argument, which is optional tells which match to return. This allows you to return the second item that matches the text. You can also pass a regular expression as the first argument. If no child with a text matches then null is returned. | ||||||||||||
findNodeByTextSyntax
Arguments
Return Type
| Returns the node with the given text. The second argument, which is optional tells which match to return. This allows you to return the second item that matches the text. You can also pass a regular expression as the first argument. If no node with a text matches then null is returned. This searches the current node and all its descendants using inorder traversal. | ||||||||||||
focusSyntax
Arguments
Return Type
| Focus the ndoe | ||||||||||||
getActionSyntax
ArgumentsNo Arguments. Return Type
| The action that should be invoked when clicking the item. This can be either a string or a function and if a string the browser will navigate to this page. | ||||||||||||
getChildrenElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element which contains all the children | ||||||||||||
getCreatedSyntax
ArgumentsNo Arguments. Return Type
| Whether the node has been rendered in the document | ||||||||||||
getDepthSyntax
ArgumentsNo Arguments. Return Type
| The depth of the tree node | ||||||||||||
getElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element for the node. | ||||||||||||
getEventHandlersHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML needed to write the inline attribute event handlers. For example " onclick=\"something()\"" | ||||||||||||
getExpandedSyntax
ArgumentsNo Arguments. Return Type
| Returns whether the node is expanded or not | ||||||||||||
getExpandIconElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element used for the expand icon of the node | ||||||||||||
getExpandIconHtmlSyntax
ArgumentsNo Arguments. Return Type
| The HTML code used to draw the expand (plus/minus) icon | ||||||||||||
getExpandIconSrcSyntax
ArgumentsNo Arguments. Return Type
| Returns the src for the image used as the expand icon. | ||||||||||||
getFirstChildSyntax
ArgumentsNo Arguments. Return Type
| Returns the first child node | ||||||||||||
getFocusedSyntax
ArgumentsNo Arguments. Return Type
| Returns whether the node is currently focused. | ||||||||||||
getHtmlSyntax
ArgumentsNo Arguments. Return Type
| The HTML text shown on the label | ||||||||||||
getIconSyntax
ArgumentsNo Arguments. Return Type
| Returns the src for the icon | ||||||||||||
getIconElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element used for the icon of the node | ||||||||||||
getIconHtmlSyntax
ArgumentsNo Arguments. Return Type
| The HTML code for the icon part of the node. | ||||||||||||
getIconSrcSyntax
ArgumentsNo Arguments. Return Type
| Returns the src for the image used for the icon. | ||||||||||||
getIdSyntax
ArgumentsNo Arguments. Return Type
| The id is used to identify the node and it needs to be unique. | ||||||||||||
getLabelElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element used for the label part of the node | ||||||||||||
getLabelHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML for the label part of the node. | ||||||||||||
getLastChildSyntax
ArgumentsNo Arguments. Return Type
| Returns the last child node | ||||||||||||
getLastShownDescendantSyntax
ArgumentsNo Arguments. Return Type
| Returns the last shown descendant in the subtree. | ||||||||||||
getLineStyleSyntax
ArgumentsNo Arguments. Return Type
| Returns a fragment of style attribute value which is used to draw the line for the tree. | ||||||||||||
getLineStyle2Syntax
ArgumentsNo Arguments. Return Type
| Return the background position style value used with getLineStyle | ||||||||||||
getNextShownNodeSyntax
ArgumentsNo Arguments. Return Type
| Returns the next shown node in the tree | ||||||||||||
getNextSiblingSyntax
ArgumentsNo Arguments. Return Type
| Returns the sibling after this or undefined if this is the last child. | ||||||||||||
getOpenIconSyntax
ArgumentsNo Arguments. Return Type
| Returns the src for the open icon. | ||||||||||||
getParentSyntax
ArgumentsNo Arguments. Return Type
| This returns the parent node. For the root node this returns null. | ||||||||||||
getPreviousShownNodeSyntax
ArgumentsNo Arguments. Return Type
| Returns the previous shown node in the tree | ||||||||||||
getPreviousSiblingSyntax
ArgumentsNo Arguments. Return Type
| Returns the node before this or undefined if there is no previous sibling | ||||||||||||
getRowClassNameSyntax
ArgumentsNo Arguments. Return Type
| Returns the class name for the row element | ||||||||||||
getRowElementSyntax
ArgumentsNo Arguments. Return Type
| Returns the element for the row part of the node. | ||||||||||||
getRowHtmlSyntax
ArgumentsNo Arguments. Return Type
| Returns the HTML needed to draw the row part of the node. | ||||||||||||
getTargetSyntax
ArgumentsNo Arguments. Return Type
| Returns the target window/frame that the item should be opened in when this item is clicked. | ||||||||||||
getTextSyntax
ArgumentsNo Arguments. Return Type
| Returns the text of the label (this is the plain text version) | ||||||||||||
getToolTipSyntax
ArgumentsNo Arguments. Return Type
| The tool tip that should be shown for the item. | ||||||||||||
getTreeSyntax
ArgumentsNo Arguments. Return Type
| Returns the root node of the tree | ||||||||||||
hasChildrenSyntax
Arguments
Return Type
| Whether this node contains any children | ||||||||||||
isLastSiblingSyntax
Arguments
Return Type
| Whether this is the last child of the parent node | ||||||||||||
isSelectedSyntax
Arguments
Return Type
| Whether the node is selected. | ||||||||||||
openPathSyntax
Arguments
Return Type
| This takes a String representing the path of nodes and opens them all. The second and third argument are optional and the allow you to select and focus the last node in the path. The path consists of the text of the nodes separated with '/'. If the path starts with '/' then the path is relative to the root. | ||||||||||||
removeSyntax
Arguments
Return Type
| Removes a child node (or the node itself if no argument is provided) | ||||||||||||
revealSyntax
Arguments
Return Type
| Expands all the parent nodes so that the node is revealed | ||||||||||||
selectSyntax
Arguments
Return Type
| Select the node. | ||||||||||||
setActionSyntax
Arguments
Return Type
| Sets the action that should be invoked when clicking the item. This can be either a string or a function and if a string the browser will navigate to this page. | ||||||||||||
setExpandedSyntax
Arguments
Return Type
| Sets the expanded state | ||||||||||||
setHtmlSyntax
Arguments
Return Type
| Sets the HTML text shown on the label. Be careful here so that you do not set this to invalid HTML because it might break the rendering | ||||||||||||
setIconSyntax
Arguments
Return Type
| Sets the src for the icon image | ||||||||||||
setIdSyntax
Arguments
Return Type
| Changes the id of the node | ||||||||||||
setOpenIconSyntax
Arguments
Return Type
| Sets the src for the open icon image | ||||||||||||
setTargetSyntax
Arguments
Return Type
| Sets the target window/frame that the item should be opened in when this item is clicked. | ||||||||||||
setTextSyntax
Arguments
Return Type
| Sets the text of the label. If this contains HTML code it will be encoded using entity references. | ||||||||||||
setToolTipSyntax
Arguments
Return Type
| Sets the tool tip that should be shown for the item. | ||||||||||||
toggleSyntax
Arguments
Return Type
| Toggles the expand state of the node | ||||||||||||
toHtmlSyntax
Arguments
Return Type
| This generates the HTML needed to write the tree node and all its descendants | ||||||||||||
updateSyntax
Arguments
Return Type
| Recreates the entire DOM tree for the node and replaces the old DOM tree with the new tree. | ||||||||||||
updateExpandIconSyntax
Arguments
Return Type
| This updates the expand (plus and minus) icon. | ||||||||||||
updateIconSyntax
Arguments
Return Type
| This updates the icon of the node. |
| Name | Type | Descripton |
| None. | ||
| Name | Descripton |
| None. | |
None.
This object is used for some configuration options like the default
icons and more.
Don't change these properties after your tree has been created.
webFXTreeConfig
| Name | Type | Descripton |
| No parameters. |
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Description |
| None. | |
| Name | Descripton |
| None. | |
None.
This class extends
WebFXTreePersistence
and therefore all methods and field available for
WebFXTreePersistence
are also available for WebFXTreeCookiePersistence.
This class is used to handle persistence of the expanded state of the
tree nodes. It uses one cookie to store the id of all expanded nodes. The
value of the cookie is the ids joined with a '+' character. For example:
"wfxt-3+wfxt-12+wfxt-22"
new WebFXTreeCookiePersistence()
| Name | Type | Descripton |
| No parameters. |
| Name | Description |
| Name | Type | Descripton |
| None. | ||
| Name | Description |
| None. | |
| Name | Type | Descripton |
cookieName | This is the name of the cookie where the expand state is stored. |
| Name | Descripton |
| None. | |
This object is used to keep track of tree nodes.
webFXTreeHandler
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Description | ||||||
addNodeSyntax
Arguments
Return Type
| Adds a node to the handler so that the handler can find it later. This is used internally and there is usually no need to call this method. | ||||||
disposeSyntax
Arguments
Return Type
| Cleans up the tree handler and all the nodes it is currently handling. | ||||||
getNodeByIdSyntax
Arguments
Return Type
| Returns the a node by a given id. | ||||||
getUniqueIdSyntax
Arguments
Return Type
| Returns an id that is not previously used. | ||||||
handleEventSyntax
Arguments
Return Type
| This is called internally when an UI even occured in a tree. | ||||||
htmlToTextSyntax
Arguments
Return Type
| This takes an HTML formatted string and returns a plain text string. | ||||||
removeNodeSyntax
Arguments
Return Type
| Removes a node from the handler. This is used internally and there is usually no need to call this method. | ||||||
textToHtmlSyntax
Arguments
Return Type
| This takes a plain text string and returns an HTML formatted string. |
| Name | Descripton |
| None. | |
None.
This class extends
WebFXTreeAbstractNode
and therefore all methods and field available for
WebFXTreeAbstractNode
are also available for WebFXTreeItem.
This is the basic tree item that the tree is built up from.
new WebFXTreeItem(sText, oAction, eParent, sIcon, sOpenIcon)
| Name | Type | Descripton |
sText | | The text (HTML) to show as a label for the tree item |
oAction | | The action to do when the node is activated. If this is String then it is treated as an URL but you can also pass a Function object which will be called when activated. |
eParent | | Optional parent tree item. If provided then the item will be added as a child to eParent |
sIcon | | The image to use as icon |
sOpenIcon | | The image to use as open icon |
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Description |
| None. | |
| Name | Type | Descripton |
| None. | ||
| Name | Descripton |
| None. | |
None.
This class is used to handle persistence of the expanded state of tree items. This class is just a dummy implementation that does not persist the state. Use WebFXTreeCookiePersistence for a cookie based implementation.
new WebFXTreePersistence()
| Name | Type | Descripton |
| No parameters. |
| Name | Description |
| Name | Type | Descripton |
| None. | ||
| Name | Description | |||||||||
getExpandedSyntax
Arguments
Return Type
| Whether the given node is expanded or not. | |||||||||
setExpandedSyntax
Arguments
Return Type
| Persists the expanded state for a node. |
| Name | Type | Descripton |
| None. | ||
| Name | Descripton |
| None. | |
| Name | Description |
| None. | |