Simple tree to display item in a hierarchical way
Deprecated API:Since version 1.38.
Event Summary
select(oControlEvent)Event is fired when a tree node is selected. selectionChange(oControlEvent)fired when the selection of the tree has been changed Method Summary
sap.ui.commons.Tree.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.Tree with name sClassName
and enriches it with the information contained in oClassInfo
. addNode(oNode)Adds some node to the aggregation nodes
. attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the select
event of this sap.ui.commons.Tree
. attachSelectionChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the selectionChange
event of this sap.ui.commons.Tree
. bindNodes(oBindingInfo)Binds aggregation nodes
to model data. destroyNodes()Destroys all the nodes in the aggregation nodes
. detachSelect(fnFunction, oListener)Detaches event handler fnFunction
from the select
event of this sap.ui.commons.Tree
. detachSelectionChange(fnFunction, oListener)Detaches event handler fnFunction
from the selectionChange
event of this sap.ui.commons.Tree
. fireSelect(mArguments?)Fires event select
to attached listeners. getHeight()Gets current value of property height
. getNodeByContext(oContext)Returns the node with the given context, or null if no such node currently exists getNodes()Gets content of aggregation nodes
. getTitle()Gets current value of property title
. getWidth()Gets current value of property width
. indexOfNode(oNode)Checks for the provided sap.ui.commons.TreeNode
in the aggregation nodes
. insertNode(oNode, iIndex)Inserts a node into the aggregation nodes
. removeNode(vNode)Removes a node from the aggregation nodes
. setHeight(sHeight)Sets a new value for property height
. setMinWidth(sMinWidth)Sets a new value for property minWidth
. setShowHeader(bShowHeader)Sets a new value for property showHeader
. setTitle(sTitle)Sets a new value for property title
. setWidth(sWidth)Sets a new value for property width
. unbindNodes()Unbinds aggregation nodes
from model data. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
isBusy,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ui.commons.Tree(sId?, mSettings?)
Constructor for a new Tree.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- nodes : sap.ui.commons.TreeNode[] (default)
- Events
- select : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- selectionChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
- Deprecated:
- Since version 1.38.
Event Detail
select(oControlEvent)
Event is fired when a tree node is selected.
Parameters:
selectionChange(oControlEvent)
fired when the selection of the tree has been changed
Parameters:
Method Detail
sap.ui.commons.Tree.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.Tree with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ui.commons.Tree.
Returns:
Adds some node to the aggregation nodes
.
Parameters:
Returns:
Attaches event handler
fnFunction
to the
select
event of this
sap.ui.commons.Tree
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.commons.Tree
itself.
Event is fired when a tree node is selected.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.commons.Tree itself |
Returns:
Attaches event handler
fnFunction
to the
selectionChange
event of this
sap.ui.commons.Tree
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.commons.Tree
itself.
fired when the selection of the tree has been changed
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.commons.Tree itself |
Returns:
Parameters:
{object} | oBindingInfo | The binding information |
Returns:
collapseAll(): void
Collapses all nodes in the tree
Destroys all the nodes in the aggregation nodes
.
Returns:
Detaches event handler
fnFunction
from the
select
event of this
sap.ui.commons.Tree
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
selectionChange
event of this
sap.ui.commons.Tree
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
expandAll(): void
Expands all nodes in the tree
fireSelect(mArguments?): boolean
Fires event
select
to attached listeners.
Listeners may prevent the default action of this event by using the preventDefault
-method on the event object.
Expects the following event parameters:
node
of type sap.ui.commons.TreeNode
The node which has been selected.nodeContext
of type object
The binding context of the selected node.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
{boolean} | Whether or not to prevent the default action |
Fires event
selectionChange
to attached listeners.
Expects the following event parameters:
nodes
of type sap.ui.commons.TreeNode[]
The nodes which has been selected.nodeContexts
of type object[]
The binding context of the selected nodes.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Gets current value of property
height
.
Tree height
Default value is auto
.
Returns:
Gets current value of property
minWidth
.
Minimal width for the Tree. Can be useful when, for example, the width is specified in percentage, to avoid the tree to become too narrow when container is resize
Returns:
getNodeByContext(oContext)
Returns the node with the given context, or null if no such node currently exists
Parameters:
- Since:
- 1.19
Gets content of aggregation
nodes
.
First level nodes
Returns:
Gets current value of property
selectionMode
.
Selection mode of the Tree.
Default value is Legacy
.
Returns:
getShowHeader(): boolean
Gets current value of property
showHeader
.
Tree Header is display. If false, the tree will be in a transparent mode
Default value is true
.
Returns:
{boolean} | Value of property showHeader |
getShowHeaderIcons(): boolean
Gets current value of property
showHeaderIcons
.
Show Header icons (e.g. Expand/Collapse all). Only consider if showHeader is true
Default value is true
.
Returns:
{boolean} | Value of property showHeaderIcons |
getShowHorizontalScrollbar(): boolean
Gets current value of property
showHorizontalScrollbar
.
Display horizontal scrollbar. If false, the overflow content will be hidden
Default value is false
.
Returns:
{boolean} | Value of property showHorizontalScrollbar |
getTitle(): string
Gets current value of property
title
.
Tree title
Returns:
{string} | Value of property title |
Gets current value of property
width
.
Tree width
Default value is auto
.
Returns:
indexOfNode(oNode): int
Checks for the provided sap.ui.commons.TreeNode
in the aggregation nodes
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a node into the aggregation nodes
.
Parameters:
{sap.ui.commons.TreeNode} | oNode | the node to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the node should be inserted at; for a negative value of iIndex , the node is inserted at position 0; for a value greater than the current size of the aggregation, the node is inserted at the last position |
Returns:
Removes all the controls from the aggregation
nodes
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes a node from the aggregation nodes
.
Parameters:
Returns:
Sets a new value for property
height
.
Tree height
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is auto
.
Parameters:
Returns:
Sets a new value for property
minWidth
.
Minimal width for the Tree. Can be useful when, for example, the width is specified in percentage, to avoid the tree to become too narrow when container is resize
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Sets a new value for property
selectionMode
.
Selection mode of the Tree.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Legacy
.
Parameters:
Returns:
Sets a new value for property
showHeader
.
Tree Header is display. If false, the tree will be in a transparent mode
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bShowHeader | New value for property showHeader |
Returns:
Sets a new value for property
showHeaderIcons
.
Show Header icons (e.g. Expand/Collapse all). Only consider if showHeader is true
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bShowHeaderIcons | New value for property showHeaderIcons |
Returns:
Sets a new value for property
showHorizontalScrollbar
.
Display horizontal scrollbar. If false, the overflow content will be hidden
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bShowHorizontalScrollbar | New value for property showHorizontalScrollbar |
Returns:
Sets a new value for property
title
.
Tree title
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sTitle | New value for property title |
Returns:
Sets a new value for property
width
.
Tree width
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is auto
.
Parameters:
Returns:
Unbinds aggregation nodes
from model data.
Returns: