Simple tree to display item in a hierarchical way
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#constructor for a general description of the syntax of the settings object.
new sap.ui.commons.Tree(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | id for the new control, generated automatically if no id is given |
|
mSettings? | object | initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
height | sap.ui.core.CSSSize | auto | Tree height Visibility: public |
minWidth | sap.ui.core.CSSSize | 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 Visibility: public |
|
selectionMode | sap.ui.commons.TreeSelectionMode | Legacy | Selection mode of the Tree. Visibility: public |
showHeader | boolean | true | Tree Header is display. If false, the tree will be in a transparent mode Visibility: public |
showHeaderIcons | boolean | true | Show Header icons (e.g. Expand/Collapse all). Only consider if showHeader is true Visibility: public |
showHorizontalScrollbar | boolean | false | Display horizontal scrollbar. If false, the overflow content will be hidden Visibility: public |
title | string | Tree title Visibility: public |
|
width | sap.ui.core.CSSSize | auto | Tree width Visibility: public |
Default Aggregation: nodes
Name | Cardinality | Type | Description |
---|---|---|---|
nodes (default) | 0..n | sap.ui.commons.TreeNode |
First level nodes |
Event | Description |
---|---|
select |
Event is fired when a tree node is selected. Listeners may prevent the default action of this event by calling the |
selectionChange |
fired when the selection of the tree has been changed |
Event is fired when a tree node is selected.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
node | sap.ui.commons.TreeNode |
The node which has been selected. |
nodeContext | object |
The binding context of the selected node. |
fired when the selection of the tree has been changed
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
nodes | sap.ui.commons.TreeNode[] |
The nodes which has been selected. |
nodeContexts | object[] |
The binding context of the selected nodes. |
Method | Description |
---|---|
addNode |
Adds some node to the aggregation nodes. |
attachSelect |
Attaches event handler When called, the context of the event handler (its Event is fired when a tree node is selected. |
attachSelectionChange |
Attaches event handler When called, the context of the event handler (its fired when the selection of the tree has been changed |
bindNodes |
Binds aggregation nodes to model data. See ManagedObject.bindAggregation for a detailed description of the possible properties of |
collapseAll |
Collapses all nodes in the tree. |
destroyNodes |
Destroys all the nodes in the aggregation nodes. |
detachSelect |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachSelectionChange |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
expandAll |
Expands all nodes in the tree. |
sap.ui.commons.Tree.extend |
Creates a new subclass of class sap.ui.commons.Tree with name
|
fireSelect |
Fires event select to attached listeners. Listeners may prevent the default action of this event by calling the |
fireSelectionChange |
Fires event selectionChange to attached listeners. |
getHeight |
Gets current value of property height. Tree height Default value is |
sap.ui.commons.Tree.getMetadata |
Returns a metadata object for class sap.ui.commons.Tree. |
getMinWidth |
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 |
getNodeByContext |
Returns the node with the given context, or null if no such node currently exists. |
getNodes |
Gets content of aggregation nodes. First level nodes |
getSelectionMode |
Gets current value of property selectionMode. Selection mode of the Tree. Default value is |
getShowHeader |
Gets current value of property showHeader. Tree Header is display. If false, the tree will be in a transparent mode Default value is |
getShowHeaderIcons |
Gets current value of property showHeaderIcons. Show Header icons (e.g. Expand/Collapse all). Only consider if showHeader is true Default value is |
getShowHorizontalScrollbar |
Gets current value of property showHorizontalScrollbar. Display horizontal scrollbar. If false, the overflow content will be hidden Default value is |
getTitle |
Gets current value of property title. Tree title |
getWidth |
Gets current value of property width. Tree width Default value is |
indexOfNode |
Checks for the provided |
insertNode |
Inserts a node into the aggregation nodes. |
removeAllNodes |
Removes all the controls from the aggregation nodes. Additionally, it unregisters them from the hosting UIArea. |
removeNode |
Removes a node from the aggregation nodes. |
setHeight |
Sets a new value for property height. Tree height When called with a value of Default value is |
setMinWidth |
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 |
setSelectionMode |
Sets a new value for property selectionMode. Selection mode of the Tree. When called with a value of Default value is |
setShowHeader |
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 Default value is |
setShowHeaderIcons |
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 Default value is |
setShowHorizontalScrollbar |
Sets a new value for property showHorizontalScrollbar. Display horizontal scrollbar. If false, the overflow content will be hidden When called with a value of Default value is |
setTitle |
Sets a new value for property title. Tree title When called with a value of |
setWidth |
Sets a new value for property width. Tree width When called with a value of Default value is |
unbindNodes |
Unbinds aggregation nodes from model data. |
Adds some node to the aggregation nodes.
Param | Type | DefaultValue | Description |
---|---|---|---|
oNode | sap.ui.commons.TreeNode |
The node to add; if empty, nothing is inserted |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Binds aggregation nodes to model data.
See ManagedObject.bindAggregation for a detailed description of the possible properties of oBindingInfo
.
Param | Type | DefaultValue | Description |
---|---|---|---|
oBindingInfo | sap.ui.base.ManagedObject.AggregationBindingInfo |
The binding information |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event select to attached listeners.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object. The return value of this method indicates whether the default action should be executed.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
node | sap.ui.commons.TreeNode |
The node which has been selected. |
|
nodeContext | object |
The binding context of the selected node. |
Fires event selectionChange to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
nodes | sap.ui.commons.TreeNode[] |
The nodes which has been selected. |
|
nodeContexts | object[] |
The binding context of the selected nodes. |
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 the node with the given context, or null if no such node currently exists.
Param | Type | DefaultValue | Description |
---|---|---|---|
oContext | sap.ui.model.Context |
The context of the node to be retrieved |
Gets current value of property selectionMode.
Selection mode of the Tree.
Default value is Legacy
.
Gets current value of property showHeader.
Tree Header is display. If false, the tree will be in a transparent mode
Default value is true
.
Gets current value of property showHeaderIcons.
Show Header icons (e.g. Expand/Collapse all). Only consider if showHeader is true
Default value is true
.
Gets current value of property showHorizontalScrollbar.
Display horizontal scrollbar. If false, the overflow content will be hidden
Default value is false
.
Checks for the provided sap.ui.commons.TreeNode
in the aggregation nodes. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oNode | sap.ui.commons.TreeNode |
The node whose index is looked for |
Inserts a node into the aggregation nodes.
Param | Type | DefaultValue | Description |
---|---|---|---|
oNode | sap.ui.commons.TreeNode |
The node to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
Removes all the controls from the aggregation nodes.
Additionally, it unregisters them from the hosting UIArea.
Removes a node from the aggregation nodes.
Param | Type | DefaultValue | Description |
---|---|---|---|
vNode | int string sap.ui.commons.TreeNode |
The node to remove or its index or id |
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'
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sHeight | sap.ui.core.CSSSize | 'auto' |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sMinWidth | sap.ui.core.CSSSize |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sSelectionMode | sap.ui.commons.TreeSelectionMode | Legacy |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowHeader | boolean | true |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowHeaderIcons | boolean | true |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowHorizontalScrollbar | boolean | false |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTitle | string |
New value for property |
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'
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize | 'auto' |
New value for property |