class sap.ui.vtm.Tree

Control sample: sap.ui.vtm.Tree
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/vtm/Tree
Application Component:

A control that contains a tree and associated data columns and provides helper methods for tree manipulation.
Call #setRootItems to provide a tree model.
Call #updateCollections after making changes to the tree hierarchy.
Call #updateModel after making changes to the tree model (either changes to the the tree hierarchy or changes to properties of tree items).

Items in the tree are plain JavaScript objects that have the following set of properties:

The sceneNodeIds, visibility, opacity and highlightColor properties are used by the extension implementing sap.ui.vtm.interfaces.IDisplayStateCalculationExtension to determine the display state of scene nodes shown in the sap.ui.vtm.Viewport associated with the sap.ui.vtm.Tree.

Example:

{
     id: jQuery.sap.uid(),
     name: "Tree item name",
     iconUrl: "sap-icon://tree",
     iconTooltip: "Group"
     absoluteMatrix: [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1],
     relativeMatrix: [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1],
     includedChildren: [],
     metadata:{
        '{"category":"SAP","field":"MATERIAL"}': ["mat1", "mat2"]]
     },
     identifiers: {
         '{"source":"SAP","type":"VE_COMPONENT"}': '[{"name":"ID", "value":"_moto_x_asm"},{"name":"version", "value": "00"},{"name": "timestamp", "value":"2016-05-18 03:44:53.93"}]',
         '{"source":"SAP","type":"MATERIAL"}': ['[{"name":"ID", "value":"mat1"}]', '[{"name":"ID", "value":"mat2"}]']
     },
     appData:{
         "bomId: "bom1",
         "bomItemId: "bomItem1",
     },
     textColor: sap.ui.vtm.TextColor.Gray,
     sceneNodeIds: ["iffffffff01021520", "iffffffff01021528"],
     visibility: true,
     opacity: 0.3,
     highlightColor: "rgba(0,255,0,0.8)"
     messages: '[{"level":"Error","text":"some error"},{"level":"Error","text":"Another error"},{"level":"Warning","A warning"}]',
     messageStatusIconUrl: "sap-icon://error",
     messageStatusIconColor: "red",
     messageStatusIconTooltip: "Error"
 }


Constructor

This class is not intended to be instantiated directly by application code. A sap.ui.vtm.Tree object is created when a sap.ui.vtm.Panel object is instantiated.

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.vtm.Tree(sId, mSettings)
Param Type Default Value Description
sId string

id for the new sap.ui.vtm.Tree.

mSettings object

Object with initial property values, aggregated objects etc. for the new sap.ui.vtm.Tree.


Properties

Name Type Default Value Description
selectionMode sap.ui.vtm.SelectionMode Single

The tree selection mode.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
_treeTable 0..1 sap.ui.table.TreeTable
headerControls 0..n sap.ui.core.Control

A set of controls such as toolbars to show above the tree.


Events Overview

Event Description
beforeModelUpdated

Raised before the model is updated.

dataColumnsChanged

Raised when the data columns are updated.

dragOver

Raised when a tree item is dragged over a tree item or an unpopulated row in a tree. To allow a drop to occur call preventDefault() on the event.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object.

dragStart

Raised when a tree item drag is initiated. To prevent a drag from being initiated call preventDefault() on the event.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object.

drop

Raised when a tree item is dropped on a tree item or an unpopulated row in a tree. A drop cannot occur unless preventDefault() is called on the sap.ui.base.Event object in the preceding dragOver event.

expandedChanged

Raised when a tree item entry is expanded or collapsed.

fixedColumnsChanged

Raised when the fixed columns are updated.

hierarchyChanged

Raised when the tree hierarchy (the set of parent child relationships) changes.

messageStatusHeaderIconClicked

Raised when a tree item message status icon is clicked.

messageStatusIconClicked

Raised when a tree item message status icon is clicked.

modelUpdated

Raised after the model has been updated.

selectionChanged

Raised when the set of selected tree items for a tree changes.

visibilityHeaderIconClicked

Raised when the icon in the visibility column header is clicked.

visibilityIconClicked

Raised when an icon in the visibility column is clicked.

beforeModelUpdated

Raised before the model is updated.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

dataColumnsChanged

Raised when the data columns are updated.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

dragOver

Raised when a tree item is dragged over a tree item or an unpopulated row in a tree. To allow a drop to occur call preventDefault() on the event.

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
dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

dragOverItem object

The tree item being dragged over or null if the tree item is being dragged over an unpopulated row.

dragOverTree sap.ui.vtm.Tree

The tree being dragged over.

dragStart

Raised when a tree item drag is initiated. To prevent a drag from being initiated call preventDefault() on the event.

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
dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

drop

Raised when a tree item is dropped on a tree item or an unpopulated row in a tree. A drop cannot occur unless preventDefault() is called on the sap.ui.base.Event object in the preceding dragOver event.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

dropItem object

The tree item that the drop occurred on or null if the item was not dropped on a tree item.

dropTree sap.ui.vtm.Tree

The tree that the drop occurred on.

expandedChanged

Raised when a tree item entry is expanded or collapsed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
item object

The tree item associated with the row that was expanded or collapsed.

expanded boolean

If true, the row was expanded, otherwise it was collapsed.

userInteraction boolean

Indicates that the event was fired due to the user clicking an expander.

fixedColumnsChanged

Raised when the fixed columns are updated.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

hierarchyChanged

Raised when the tree hierarchy (the set of parent child relationships) changes.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

messageStatusHeaderIconClicked

Raised when a tree item message status icon is clicked.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

messageStatusIconClicked

Raised when a tree item message status icon is clicked.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
items object

The associated tree item.

control sap.ui.core.Control

The message status icon control that was clicked.

modelUpdated

Raised after the model has been updated.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

selectionChanged

Raised when the set of selected tree items for a tree changes.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
addedItems object[]

The tree items that were added to the selection set for the tree.

removedItems object[]

The tree items that were removed from the selection set for the tree.

userInteraction boolean

Indicates that the event was fired due to an explicit user interaction

visibilityHeaderIconClicked

Raised when the icon in the visibility column header is clicked.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
visibility boolean

The visibility state of the tree item.

control sap.ui.core.Control

The visibility header icon control that was clicked.

visibilityIconClicked

Raised when an icon in the visibility column is clicked.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
item object

The tree item whose visibility icon was clicked.

visibility boolean

The visibility state of the tree item.

control sap.ui.core.Control

The visibility icon control that was clicked.


Methods Overview

Method Description
addHeaderControl

Adds some headerControl to the aggregation headerControls.

addRoot

Adds a root item to the tree.

attachBeforeModelUpdated

Attaches event handler fnFunction to the beforeModelUpdated event of this sap.ui.vtm.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.vtm.Tree itself.

Raised before the model is updated.

attachDataColumnsChanged

Attaches event handler fnFunction to the dataColumnsChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the data columns are updated.

attachDragOver

Attaches event handler fnFunction to the dragOver event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item is dragged over a tree item or an unpopulated row in a tree. To allow a drop to occur call preventDefault() on the event.

attachDragStart

Attaches event handler fnFunction to the dragStart event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item drag is initiated. To prevent a drag from being initiated call preventDefault() on the event.

attachDrop

Attaches event handler fnFunction to the drop event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item is dropped on a tree item or an unpopulated row in a tree. A drop cannot occur unless preventDefault() is called on the sap.ui.base.Event object in the preceding dragOver event.

attachExpandedChanged

Attaches event handler fnFunction to the expandedChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item entry is expanded or collapsed.

attachFixedColumnsChanged

Attaches event handler fnFunction to the fixedColumnsChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the fixed columns are updated.

attachHierarchyChanged

Attaches event handler fnFunction to the hierarchyChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the tree hierarchy (the set of parent child relationships) changes.

attachMessageStatusHeaderIconClicked

Attaches event handler fnFunction to the messageStatusHeaderIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item message status icon is clicked.

attachMessageStatusIconClicked

Attaches event handler fnFunction to the messageStatusIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item message status icon is clicked.

attachModelUpdated

Attaches event handler fnFunction to the modelUpdated event of this sap.ui.vtm.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.vtm.Tree itself.

Raised after the model has been updated.

attachSelectionChanged

Attaches event handler fnFunction to the selectionChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the set of selected tree items for a tree changes.

attachVisibilityHeaderIconClicked

Attaches event handler fnFunction to the visibilityHeaderIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the icon in the visibility column header is clicked.

attachVisibilityIconClicked

Attaches event handler fnFunction to the visibilityIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when an icon in the visibility column is clicked.

collapseAll

Expands all tree items in the tree.

destroyHeaderControls

Destroys all the headerControls in the aggregation headerControls.

detachBeforeModelUpdated

Detaches event handler fnFunction from the beforeModelUpdated event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachDataColumnsChanged

Detaches event handler fnFunction from the dataColumnsChanged event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachDragOver

Detaches event handler fnFunction from the dragOver event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachDragStart

Detaches event handler fnFunction from the dragStart event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachDrop

Detaches event handler fnFunction from the drop event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachExpandedChanged

Detaches event handler fnFunction from the expandedChanged event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachFixedColumnsChanged

Detaches event handler fnFunction from the fixedColumnsChanged event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachHierarchyChanged

Detaches event handler fnFunction from the hierarchyChanged event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachMessageStatusHeaderIconClicked

Detaches event handler fnFunction from the messageStatusHeaderIconClicked event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachMessageStatusIconClicked

Detaches event handler fnFunction from the messageStatusIconClicked event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachModelUpdated

Detaches event handler fnFunction from the modelUpdated event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachSelectionChanged

Detaches event handler fnFunction from the selectionChanged event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachVisibilityHeaderIconClicked

Detaches event handler fnFunction from the visibilityHeaderIconClicked event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

detachVisibilityIconClicked

Detaches event handler fnFunction from the visibilityIconClicked event of this sap.ui.vtm.Tree.

The passed function and listener object must match the ones used for event registration.

expandAll

Expands all tree items in the tree.

expandAncestors

Expands all ancestors of specified tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

expandToLevel

Expands tree items in the tree from the root down to the given level.

sap.ui.vtm.Tree.extend

Creates a new subclass of class sap.ui.vtm.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.

fireBeforeModelUpdated

Fires event beforeModelUpdated to attached listeners.

fireDataColumnsChanged

Fires event dataColumnsChanged to attached listeners.

fireDragOver

Fires event dragOver 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.

fireDragStart

Fires event dragStart 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.

fireDrop

Fires event drop to attached listeners.

fireExpandedChanged

Fires event expandedChanged to attached listeners.

fireFixedColumnsChanged

Fires event fixedColumnsChanged to attached listeners.

fireHierarchyChanged

Fires event hierarchyChanged to attached listeners.

fireMessageStatusHeaderIconClicked

Fires event messageStatusHeaderIconClicked to attached listeners.

fireMessageStatusIconClicked

Fires event messageStatusIconClicked to attached listeners.

fireModelUpdated

Fires event modelUpdated to attached listeners.

fireSelectionChanged

Fires event selectionChanged to attached listeners.

fireVisibilityHeaderIconClicked

Fires event visibilityHeaderIconClicked to attached listeners.

fireVisibilityIconClicked

Fires event visibilityIconClicked to attached listeners.

getAllItems

Finds all tree items in the tree of a given type.

This method relies on #updateCollections being called after the tree is populated/changed.

getAncestorItems

Finds all ancestors of a tree item.

An empty array will be returned for root items.
Otherwise an array of ancestor tree items will be returned.
The array will be ordered such that:

  • The root item will be first element in the array.
  • The parent item will be last element in the array.

This method relies on #updateCollections being called after the tree is populated/changed.

getDataColumns

Gets the set of data columns for the tree.

getDescendantItems

Gets the descendants of a tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

getExpanded

Gets whether the row associated with a tree item is expanded.

This method relies on #updateCollections being called after the tree is populated/changed.

getFixedColumns

Gets the fixed columns for the tree.

getHeaderControls

Gets content of aggregation headerControls.

A set of controls such as toolbars to show above the tree.

getHighlightColor

Gets the highlightColor property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

getItem

Finds a tree item by id or returns undefined if it is not found.
This method relies on #updateCollections being called after the tree is populated/changed.

getItemByBindingContextPath

Finds a tree item by binding context path or returns undefined if it is not found. This is typically used to find the corresponding tree item in event handlers for custom column template controls.

getItemsBySceneNodeId

Finds the set of tree items that are associated with a particular scene node id.

This method relies on #updateCollections being called after the tree is populated/changed.

sap.ui.vtm.Tree.getMetadata

Returns a metadata object for class sap.ui.vtm.Tree.

getOpacity

Gets the opacity property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

getPanel

Gets the panel this tree belongs to.

getParentItem

Finds a parent tree item or returns undefined if it is not found.

This method relies on #updateCollections being called after the tree is populated/changed.

getRootItems

Gets the root tree items.

getSelectedItems

Gets the selected tree items.

getSelectionMode

Gets current value of property selectionMode.

The tree selection mode.

Default value is "Single".

getVisibility

Gets the visibility property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

indexOfHeaderControl

Checks for the provided sap.ui.core.Control in the aggregation headerControls. and returns its index if found or -1 otherwise.

insertHeaderControl

Inserts a headerControl into the aggregation headerControls.

isEmpty

Returns whether the tree is empty.

isExcludedItem

Returns whether a tree item object is an excluded tree item in the tree model of this sap.ui.vtm.Tree.

This method relies on #updateCollections being called after the tree is populated/changed.

isIncludedItem

Returns whether a tree item object is an included tree item in the tree model of this sap.ui.vtm.Tree.

This method relies on #updateCollections being called after the tree is populated/changed.

removeAllHeaderControls

Removes all the controls from the aggregation headerControls.

Additionally, it unregisters them from the hosting UIArea.

removeHeaderControl

Removes a headerControl from the aggregation headerControls.

removeRoot

Removes a root item from the tree.

scrollIntoView

Brings specified tree item to view, expanding the tree if necessary.

This method relies on #updateCollections being called after the tree is populated/changed.

setDataColumns

Sets the data columns for the tree.

setExpanded

Expands or collapses the row associated with a tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

setFixedColumns

Sets the fixed columns for the tree.

setHighlightColor

Sets the highlightColor property of some tree items.

setOpacity

Sets the opacity property of some tree items.

setRootItems

Sets the root tree items.

setSelectedItems

Sets the selected tree items.

This method relies on #updateCollections being called after the tree is populated/changed.

setSelectionMode

Sets a new value for property selectionMode.

The tree selection mode.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Single".

setVisibility

Sets the visibility property of some tree items.

traverseBranch

Recursively traverses a tree branch calling a function on each item (including the tree item that is the root of the branch).

traverseTree

Recursively traverses the tree calling a function on each item.

updateCollections

Updates collections used to find tree items by various criteria.
This method should be called whenever the tree has been populated, when the tree structure has changed or when any of the following fields have been modified for a tree item in the tree:

  • id
  • sceneNodeIds *
  • includedChildren
  • excludedChildren

Correct usage of this method is required by the following methods:
* When the only changes to the tree since the last call to #updateCollections are changes to the sceneNodeIds properties of the tree items, #updateTreeItemsBySceneNodeId can be used instead of #updateCollections.

updateModel

Updates the model.

The application should call this whenever changes are made to the tree model.

updateTreeItemsBySceneNodeId

Update the collection used by #getItemsBySceneNodeId.

This is useful when the only changes to the tree since the last call to #updateCollections are changes to the sceneNodeIds properties of the tree items.

validateTree

Validates the tree. If errors are found they are written to the console log and an exception is thrown.

addHeaderControl

Adds some headerControl to the aggregation headerControls.

Param Type DefaultValue Description
oHeaderControl sap.ui.core.Control

The headerControl to add; if empty, nothing is inserted

addRoot

Adds a root item to the tree.

Param Type DefaultValue Description
rootItemToAdd object

The root tree item to remove.

attachBeforeModelUpdated

Attaches event handler fnFunction to the beforeModelUpdated event of this sap.ui.vtm.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.vtm.Tree itself.

Raised before the model is updated.

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 sap.ui.vtm.Tree itself

attachDataColumnsChanged

Attaches event handler fnFunction to the dataColumnsChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the data columns are updated.

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 sap.ui.vtm.Tree itself

attachDragOver

Attaches event handler fnFunction to the dragOver event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item is dragged over a tree item or an unpopulated row in a tree. To allow a drop to occur call preventDefault() on the event.

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 sap.ui.vtm.Tree itself

attachDragStart

Attaches event handler fnFunction to the dragStart event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item drag is initiated. To prevent a drag from being initiated call preventDefault() on the event.

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 sap.ui.vtm.Tree itself

attachDrop

Attaches event handler fnFunction to the drop event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item is dropped on a tree item or an unpopulated row in a tree. A drop cannot occur unless preventDefault() is called on the sap.ui.base.Event object in the preceding dragOver event.

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 sap.ui.vtm.Tree itself

attachExpandedChanged

Attaches event handler fnFunction to the expandedChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item entry is expanded or collapsed.

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 sap.ui.vtm.Tree itself

attachFixedColumnsChanged

Attaches event handler fnFunction to the fixedColumnsChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the fixed columns are updated.

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 sap.ui.vtm.Tree itself

attachHierarchyChanged

Attaches event handler fnFunction to the hierarchyChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the tree hierarchy (the set of parent child relationships) changes.

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 sap.ui.vtm.Tree itself

attachMessageStatusHeaderIconClicked

Attaches event handler fnFunction to the messageStatusHeaderIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item message status icon is clicked.

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 sap.ui.vtm.Tree itself

attachMessageStatusIconClicked

Attaches event handler fnFunction to the messageStatusIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when a tree item message status icon is clicked.

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 sap.ui.vtm.Tree itself

attachModelUpdated

Attaches event handler fnFunction to the modelUpdated event of this sap.ui.vtm.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.vtm.Tree itself.

Raised after the model has been updated.

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 sap.ui.vtm.Tree itself

attachSelectionChanged

Attaches event handler fnFunction to the selectionChanged event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the set of selected tree items for a tree changes.

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 sap.ui.vtm.Tree itself

attachVisibilityHeaderIconClicked

Attaches event handler fnFunction to the visibilityHeaderIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when the icon in the visibility column header is clicked.

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 sap.ui.vtm.Tree itself

attachVisibilityIconClicked

Attaches event handler fnFunction to the visibilityIconClicked event of this sap.ui.vtm.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.vtm.Tree itself.

Raised when an icon in the visibility column is clicked.

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 sap.ui.vtm.Tree itself

collapseAll

Expands all tree items in the tree.

destroyHeaderControls

Destroys all the headerControls in the aggregation headerControls.

detachBeforeModelUpdated

Detaches event handler fnFunction from the beforeModelUpdated event of this sap.ui.vtm.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

detachDataColumnsChanged

Detaches event handler fnFunction from the dataColumnsChanged event of this sap.ui.vtm.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

detachDragOver

Detaches event handler fnFunction from the dragOver event of this sap.ui.vtm.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

detachDragStart

Detaches event handler fnFunction from the dragStart event of this sap.ui.vtm.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

detachDrop

Detaches event handler fnFunction from the drop event of this sap.ui.vtm.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

detachExpandedChanged

Detaches event handler fnFunction from the expandedChanged event of this sap.ui.vtm.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

detachFixedColumnsChanged

Detaches event handler fnFunction from the fixedColumnsChanged event of this sap.ui.vtm.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

detachHierarchyChanged

Detaches event handler fnFunction from the hierarchyChanged event of this sap.ui.vtm.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

detachMessageStatusHeaderIconClicked

Detaches event handler fnFunction from the messageStatusHeaderIconClicked event of this sap.ui.vtm.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

detachMessageStatusIconClicked

Detaches event handler fnFunction from the messageStatusIconClicked event of this sap.ui.vtm.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

detachModelUpdated

Detaches event handler fnFunction from the modelUpdated event of this sap.ui.vtm.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

detachSelectionChanged

Detaches event handler fnFunction from the selectionChanged event of this sap.ui.vtm.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

detachVisibilityHeaderIconClicked

Detaches event handler fnFunction from the visibilityHeaderIconClicked event of this sap.ui.vtm.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

detachVisibilityIconClicked

Detaches event handler fnFunction from the visibilityIconClicked event of this sap.ui.vtm.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

expandAll

Expands all tree items in the tree.

expandAncestors

Expands all ancestors of specified tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object

Tree item.

expandToLevel

Expands tree items in the tree from the root down to the given level.

Param Type DefaultValue Description
iLevel int

The tree level to expand to.

sap.ui.vtm.Tree.extend

Creates a new subclass of class sap.ui.vtm.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

fireBeforeModelUpdated

Fires event beforeModelUpdated to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireDataColumnsChanged

Fires event dataColumnsChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireDragOver

Fires event dragOver 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

dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

dragOverItem object

The tree item being dragged over or null if the tree item is being dragged over an unpopulated row.

dragOverTree sap.ui.vtm.Tree

The tree being dragged over.

fireDragStart

Fires event dragStart 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

dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

fireDrop

Fires event drop to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

dragItem object

The tree item that was dragged.

dragTree sap.ui.vtm.Tree

The tree of the tree item that was dragged.

dropItem object

The tree item that the drop occurred on or null if the item was not dropped on a tree item.

dropTree sap.ui.vtm.Tree

The tree that the drop occurred on.

fireExpandedChanged

Fires event expandedChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

item object

The tree item associated with the row that was expanded or collapsed.

expanded boolean

If true, the row was expanded, otherwise it was collapsed.

userInteraction boolean

Indicates that the event was fired due to the user clicking an expander.

fireFixedColumnsChanged

Fires event fixedColumnsChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireHierarchyChanged

Fires event hierarchyChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireMessageStatusHeaderIconClicked

Fires event messageStatusHeaderIconClicked to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireMessageStatusIconClicked

Fires event messageStatusIconClicked to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

items object

The associated tree item.

control sap.ui.core.Control

The message status icon control that was clicked.

fireModelUpdated

Fires event modelUpdated to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireSelectionChanged

Fires event selectionChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

addedItems object[]

The tree items that were added to the selection set for the tree.

removedItems object[]

The tree items that were removed from the selection set for the tree.

userInteraction boolean

Indicates that the event was fired due to an explicit user interaction

fireVisibilityHeaderIconClicked

Fires event visibilityHeaderIconClicked to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

visibility boolean

The visibility state of the tree item.

control sap.ui.core.Control

The visibility header icon control that was clicked.

fireVisibilityIconClicked

Fires event visibilityIconClicked to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

item object

The tree item whose visibility icon was clicked.

visibility boolean

The visibility state of the tree item.

control sap.ui.core.Control

The visibility icon control that was clicked.

getAllItems

Finds all tree items in the tree of a given type.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItemType sap.ui.vtm.TreeItemType

Indicates the types of tree item to match. Defaults to sap.ui.vtm.TreeItemType.Included.

getAncestorItems

Finds all ancestors of a tree item.

An empty array will be returned for root items.
Otherwise an array of ancestor tree items will be returned.
The array will be ordered such that:

  • The root item will be first element in the array.
  • The parent item will be last element in the array.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object string

The tree item or id of the tree item to get the ancestors of.

getDataColumns

Gets the set of data columns for the tree.

getDescendantItems

Gets the descendants of a tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object string

The tree item or id of the tree item to get the descendants of.

treeItemType sap.ui.vtm.TreeItemType

Indicates the types of tree item to match. Defaults to sap.ui.vtm.TreeItemType.Included.

getExpanded

Gets whether the row associated with a tree item is expanded.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
oTreeItem object

The tree item.

getFixedColumns

Gets the fixed columns for the tree.

getHeaderControls

Gets content of aggregation headerControls.

A set of controls such as toolbars to show above the tree.

getHighlightColor

Gets the highlightColor property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

getItem

Finds a tree item by id or returns undefined if it is not found.
This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItemId string

The tree item id to look for.

getItemByBindingContextPath

Finds a tree item by binding context path or returns undefined if it is not found. This is typically used to find the corresponding tree item in event handlers for custom column template controls.

Param Type DefaultValue Description
bindingContextPath string

The binding context path to look for.

getItemsBySceneNodeId

Finds the set of tree items that are associated with a particular scene node id.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
sceneNodeIds string string[]

The scene node ID or IDs to find.

treeItemType sap.ui.vtm.TreeItemType

Indicates the types of tree item to match. Defaults to sap.ui.vtm.TreeItemType.Included.

sap.ui.vtm.Tree.getMetadata

Returns a metadata object for class sap.ui.vtm.Tree.

getOpacity

Gets the opacity property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

getPanel

Gets the panel this tree belongs to.

getParentItem

Finds a parent tree item or returns undefined if it is not found.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object string

The child tree item or child tree item id.

getRootItems

Gets the root tree items.

getSelectedItems

Gets the selected tree items.

getSelectionMode

Gets current value of property selectionMode.

The tree selection mode.

Default value is "Single".

getVisibility

Gets the visibility property of a tree item or array of tree items.

If a single tree item is passed to the method then a single value is returned.
If an array of tree items is passed to the method then an array is returned.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

indexOfHeaderControl

Checks for the provided sap.ui.core.Control in the aggregation headerControls. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oHeaderControl sap.ui.core.Control

The headerControl whose index is looked for

insertHeaderControl

Inserts a headerControl into the aggregation headerControls.

Param Type DefaultValue Description
oHeaderControl sap.ui.core.Control

The headerControl to insert; if empty, nothing is inserted

iIndex int

The 0-based index the headerControl should be inserted at; for a negative value of iIndex, the headerControl is inserted at position 0; for a value greater than the current size of the aggregation, the headerControl is inserted at the last position

isEmpty

Returns whether the tree is empty.

isExcludedItem

Returns whether a tree item object is an excluded tree item in the tree model of this sap.ui.vtm.Tree.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object string

The tree item or tree item id to check.

isIncludedItem

Returns whether a tree item object is an included tree item in the tree model of this sap.ui.vtm.Tree.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object string

The tree item or tree item id to check.

removeAllHeaderControls

Removes all the controls from the aggregation headerControls.

Additionally, it unregisters them from the hosting UIArea.

removeHeaderControl

Removes a headerControl from the aggregation headerControls.

Param Type DefaultValue Description
vHeaderControl int string sap.ui.core.Control

The headerControl to remove or its index or id

removeRoot

Removes a root item from the tree.

Param Type DefaultValue Description
rootItemToRemove string object

The root tree item to remove (or its id).

scrollIntoView

Brings specified tree item to view, expanding the tree if necessary.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
treeItem object

The tree item to scroll into view.

setDataColumns

Sets the data columns for the tree.

Param Type DefaultValue Description
dataColumns sap.ui.vtm.Column[]

The data columns for the tree.

setExpanded

Expands or collapses the row associated with a tree item.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
oTreeItem object

The tree item.

bExpanded boolean

If true the row will be expanded otherwise it will be collapsed.

setFixedColumns

Sets the fixed columns for the tree.

Param Type DefaultValue Description
fixedColumns sap.ui.vtm.Column[]

The fixed columns.

setHighlightColor

Sets the highlightColor property of some tree items.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

highlightColor sap.ui.core.CSSColor

The new highlight color value of the tree items.

recursive boolean

If true changes are applied recursively to included and excluded descendant tree items. Default value is true.

visualOnly boolean

If true changes are only made to tree items that have a defined visibility property value. Default value is true.

refresh boolean

If true, #updateModel is called to refresh the tree (so the check eye icons are updated) and sap.ui.vtm.Viewport#refresh is called on the corresponding sap.ui.vtm.Viewport to recalculate the display state. Default value is true.

setOpacity

Sets the opacity property of some tree items.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

opacity float

The new opacity value of the tree items (between 0.0 and 1.0 inclusive).

recursive boolean

If true changes are applied recursively to included and excluded descendant tree items. Default value is true.

visualOnly boolean

If true changes are only made to tree items that have a defined visibility property value. Default value is true.

refresh boolean

If true, #updateModel is called to refresh the tree (so the check eye icons are updated) and sap.ui.vtm.Viewport#refresh is called on the corresponding sap.ui.vtm.Viewport to recalculate the display state. Default value is true.

setRootItems

Sets the root tree items.

Param Type DefaultValue Description
rootItems object[]

The root tree items.

setSelectedItems

Sets the selected tree items.

This method relies on #updateCollections being called after the tree is populated/changed.

Param Type DefaultValue Description
items object object[]

Tree item(s) to select in the tree.

scrollToView boolean

When set brings selected item into view. Default value is to true.

setSelectionMode

Sets a new value for property selectionMode.

The tree selection mode.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "Single".

Param Type DefaultValue Description
sSelectionMode sap.ui.vtm.SelectionMode "Single"

New value for property selectionMode

setVisibility

Sets the visibility property of some tree items.

Param Type DefaultValue Description
treeItems object object[]

The tree item or the array of tree items.

visibility boolean

The new visibility state of the tree items.

recursive boolean

If true changes are applied recursively to included and excluded descendant tree items. Default value is true.

visualOnly boolean

If true changes are only made to tree items that have a defined visibility property value. Default value is true.

refresh boolean

If true, #updateModel is called to refresh the tree (so the check eye icons are updated) and sap.ui.vtm.Viewport#refresh is called on the corresponding sap.ui.vtm.Viewport to recalculate the display state. Default value is true.

traverseBranch

Recursively traverses a tree branch calling a function on each item (including the tree item that is the root of the branch).

Param Type DefaultValue Description
treeItem object

The root of the branch to apply the function to.

callback function

The function to apply to tree items in the branch.
The first parameter to the callback function is the current tree item object (at the current point of the traversal.
The second parameter to the callback function is the set of ancestors of the current tree item in the traversal.
The function may return a sap.ui.vtm.ChildCollectionType value to specify which immediate children of the tree item to traverse.
If no such value is returned a default of sap.ui.vtm.ChildCollectionType.Included is used.

traverseTree

Recursively traverses the tree calling a function on each item.

Param Type DefaultValue Description
callback function

The function to apply to tree items in the tree.
The first parameter to the callback function is the current tree item object (at the current point of the traversal.
The second parameter to the callback function is the set of ancestors of the current tree item.
The function may return a sap.ui.vtm.ChildCollectionType value to specify which immediate children to traverse. If no such value is returned a default of sap.ui.vtm.ChildCollectionType.Included is used.

updateCollections

Updates collections used to find tree items by various criteria.
This method should be called whenever the tree has been populated, when the tree structure has changed or when any of the following fields have been modified for a tree item in the tree:

  • id
  • sceneNodeIds *
  • includedChildren
  • excludedChildren

Correct usage of this method is required by the following methods:
* When the only changes to the tree since the last call to #updateCollections are changes to the sceneNodeIds properties of the tree items, #updateTreeItemsBySceneNodeId can be used instead of #updateCollections.

Param Type DefaultValue Description
checkForHierarchyChanges boolean

When true a hierarchyChanged event will be raised if the hierarchy has changed since the last time this method was called. This method is called when the tree is empty as part of the sap.ui.vtm.Tree constructor, so the first time it is called from application code a hierarchyChanged event will be raised if the tree has been populated. The default value for the parameter is true.

updateModel

Updates the model.

The application should call this whenever changes are made to the tree model.

Param Type DefaultValue Description
forceRecreate boolean

If true, the tree control model and bindings are recreated. If false and the model and bindings already exist, this call only results in the bindings being refreshed. Rebuilding the model and bindings is much more expensive than refreshing the bindings, so only use a value of true for this parameter when a value of false does not result in the the tree being updated correctly.

updateTreeItemsBySceneNodeId

Update the collection used by #getItemsBySceneNodeId.

This is useful when the only changes to the tree since the last call to #updateCollections are changes to the sceneNodeIds properties of the tree items.

validateTree

Validates the tree. If errors are found they are written to the console log and an exception is thrown.