class %ZEN.Component.dynaTree
extends component
This component draws an HTML tree control based on executing
a user-provided callback method.
There are several ways that you can provide data for the tree control:
- Using the OnGetNodeInfo callback to get data for each node within the tree.
- Using the dataGlobal property to use data stored within a global to supply the contents of the tree.
- Using the OnGetTreeInfo callback to fill in a local array that supplies the contents of the tree.
parameter IMAGECONTRACTED;
Default url of image used for contracted tree node.
This is only used when showLines is false.
parameter IMAGEEXPANDED;
Default url of image used for expanded tree node.
This is only used when showLines is false.
parameter IMAGEFOLDERCLOSED = "folderclosed.gif";
Default url of image used for closed folder nodes.
parameter IMAGEFOLDEROPEN = "folderopen.gif";
Default url of image used for open folder nodes.
parameter IMAGENODE = "node.gif";
Default url of image used for a leaf node in the tree.
property OnGetNodeInfo
as %ZEN.Datatype.delegator(FORMALSPEC="*tSC:%Status,&tParameters:%String,pLevel:%Integer,&pHandle:%String,pNodeInfo:%ZEN.Auxiliary.NodeInfo",RETURNTYPE="%Boolean");
Name of Server-side callback method to call to get information
for each node of this tree.
This must be the name of a server-only method in the page
class that contains this component.
property OnGetTreeInfo
as %ZEN.Datatype.delegator(FORMALSPEC="pRoot:%String,*pTree:%List,&tParameters:%String",RETURNTYPE="%Status");
Name of Server-side callback method to call to get information
for the entire contents of the tree.
This is a lower-level callback than the OnGetNodeInfo
callback. It lets you define the contents of the entire tree using
a multi-dimensional array.
If this is defined then the OnGetNodeInfo callback is not used.
This must be the name of a server-only method in the page
class that contains this component.
The callback method should be similar to this:
property childIndent
as %ZEN.Datatype.length [ InitialExpression = 20 ];
Specifies amount child nodes should be indented.
This value is only applied when showLines is false.
property dataGlobal
as %ZEN.Datatype.glvn;
If defined, and there is no user-defined OnGetNodeInfo
callback method, then this is the name of a global that is
used to provide the contents of this tree.
The global takes the form:
^glvn("A","B") = URL
The global subscripts define the node names; The URL value
is a link that is used when the user clicks on the node.
property imageContracted
as %ZEN.Datatype.uri;
url of image used for contracted tree node (when showLines is false).
property imageExpanded
as %ZEN.Datatype.uri;
url of image used for expanded tree nodes (when showLines is false).
If you set this, make sure you also set imageContracted.
property imageFolderClosed
as %ZEN.Datatype.uri;
url of image used for a closed folder node in the tree.
If not specified, a default image is supplied.
property imageFolderOpen
as %ZEN.Datatype.uri;
url of image used for an open folder node in the tree.
If not specified, a default image is supplied.
property imageNode
as %ZEN.Datatype.uri;
url of image used for a leaf node in the tree.
If not specified, a default image is supplied.
property nodeCount
as %ZEN.Datatype.integer(XMLPROJECTION="none",ZENSETTING=0) [ InitialExpression = 0 ];
This is used to keep track of how many nodes are in this tree.
property onchange
as %ZEN.Datatype.eventHandler;
onchange event handler:
If defined, this event is fired when
the user changes the value of this component.
property onclick
as %ZEN.Datatype.eventHandler;
onclick event handler:
If defined, this event is fired when
the user clicks on an item
property ondblclick
as %ZEN.Datatype.eventHandler;
ondblclick event handler:
If defined, this event is fired when
the user double-clicks on an item
property parameters
as array of %ZEN.Auxiliary.parameter(XMLKEYNAME="paramName",XMLNAME="parameter",XMLPROJECTION="ELEMENT");
User-defined set of parameters. These values are passed on
to the user callback function that provides the contents of
this view. Typically this is used to hold search parameters.
property selectedIndex
as %ZEN.Datatype.integer [ InitialExpression = -1 ];
Index (0-based) of current selected tree node.
property showFolders
as %ZEN.Datatype.boolean [ InitialExpression = 1 ];
If true and showLines is false, display open and closed folder icons as well as icons for
each node in the tree. The default is true.
If showLines is true, this property is ignored.
property showLines
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
If true, show dashed lines (as a series of images) between
the nodes of the tree.
property text
as %ZEN.Datatype.string(XMLPROJECTION="none");
Text (display) value of current item within the view.
Do not access this directly; use getProperty('text') instead.
property value
as %ZEN.Datatype.string(XMLPROJECTION="none");
Logical value of current item within the view.
Do not access this directly; use getProperty('value') instead.
method %DrawHTML()
Draw HTML for this component.
classmethod %GetImageDirectory()
as %String
Return the directory from which built-in images are supplied.
method dragStartHandler(dragData)
[ Language = javascript ]
Built-in drag handler for tree component.
Let the user drag the selected node.
method expandAll(flag)
[ Language = javascript ]
Expand (if flag is true) or contract (if flag is false) all
nodes within the true;
Does not invoke any callback methods.
method getNodeParent(nodeNo)
[ Language = javascript ]
Return the index number (0-based) of the parent of the specified node.
nodeNo is the index number of the node (0-based).
method getNodeText(nodeNo)
[ Language = javascript ]
Get the display value of a given node.
nodeNo is the index number of the node (0-based).
If nodeNo is not provided use the current selected noded.
method getNodeValue(nodeNo)
[ Language = javascript ]
Get the logical value of a given node.
nodeNo is the index number of the node (0-based).
If nodeNo is not provided use the current selected noded.
method getSelectedIndex()
[ Language = javascript ]
Return the index number (0-based) of the current node.
Return -1 if no node is selected.
method getValue()
[ Language = javascript ]
Get the logical value of the current selected node.
method itemClicked(idx, level)
[ Language = javascript ]
User clicked on an item.
idx is index of node (0 based).
level is indentation level of node (0 based); this
is passed on to the callback.
method itemDblClicked(idx, level)
[ Language = javascript ]
User double-clicked on an item.
method reloadNode(nodeNo)
[ Language = javascript ]
Reload the child nodes of the given node.
nodeNo is the index number of the node (0-based).
This method does nothing if it called for a leaf node (a node without
children).
This method only works when the OnGetTreeInfo
callback is used to supply the contents of the tree.
method selectItem(idx)
[ Language = javascript ]
Select the given node within the tree.
idx is index of node (0 based).
method setNodeStyle(nodeNo, style)
[ Language = javascript ]
Set the css style for of a given node.
style should contain css style declarations
(e.g., 'color: red;')
nodeNo is the index number of the node (0-based).
method setNodeText(nodeNo, text)
[ Language = javascript ]
Set the display value of a given node.
nodeNo is the index number of the node (0-based).
method setNodeValue(nodeNo, value)
[ Language = javascript ]
Set the logical value of a given node.
nodeNo is the index number of the node (0-based).
method setProperty(property, value, value2)
[ Language = javascript ]
Set the value of a named property.
method toggleExpanded(nodeNo)
[ Language = javascript ]
Toggle the current expanded state of a given node within the tree.
nodeNo is the index number of the node (0-based).