class sap.ui.table.TreeTable

Control sample: sap.ui.table.TreeTable
Visiblity: public
UX Guidelines: Tree Table
Implements:
Available since: N/A
Module: sap/ui/table/TreeTable
Application Component: CA-UI5-TBL

The TreeTable control provides a comprehensive set of features to display hierarchical data.

Documentation links:


Constructor

Constructor for a new TreeTable.

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.table.TreeTable(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


Properties

Name Type Default Value Description
collapseRecursive boolean true

Setting collapseRecursive to true means, that when collapsing a node all subsequent child nodes will also be collapsed. This property is only supported with sap.ui.model.odata.v2.ODataModel. Note: collapseRecursive is currently not supported if your OData service exposes the hierarchy annotation hierarchy-descendant-count-for. In this case the value of the collapseRecursive property is ignored. For more information about the OData hierarchy annotations, please see the SAP Annotations for OData Version 2.0 specification.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      collapseRecursive: true
    }
  });

Visibility: public
expandFirstLevel boolean false

Specifies whether the first level is expanded.

The value of the property is only taken into account if no parameter numberOfExpandedLevels is given in the binding information. Changes to this property after the table is bound do not have any effect unless an explicit (re-)bind of the rows aggregation is done.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      numberOfExpandedLevels: 1
    }
  });

Visibility: public
groupHeaderProperty string

The property name of the rows data which will be displayed as a group header if the group mode is enabled

Visibility: public
rootLevel int 0

The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services. This property is only supported when the TreeTable uses an underlying odata services with hierarchy annotations. This property is only supported with sap.ui.model.odata.v2.ODataModel The hierarchy annotations may also be provided locally as a parameter for the ODataTreeBinding.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      rootLevel: 1
    }
  });

Visibility: public
useGroupMode boolean false

If group mode is enabled nodes with subitems are rendered as if they were group headers. This can be used to do the grouping for an OData service on the backend and visualize this in a table.

Visibility: public

Borrowed Properties

Name Type Default Value Description
alternateRowColors boolean false

Enables alternating table row colors. Alternate row coloring is not available for the tree mode.

Since: 1.52.

Visibility: public
columnHeaderHeight int

Header row height in pixel. If a value greater than 0 is set, it overrides the height defined in the rowHeight property for the rows in the table's header. The value defines the minimum height, but it cannot be less than the default height based on the content density configuration. The actual height can increase based on the content.

Note: In a MultiLabel scenario, the height is applied to each individual row of the table's header.

Visibility: public
columnHeaderVisible boolean true

Flag whether the column header is visible or not.

Caution: Please be aware that when setting this property to false, a 100% accessibility of the table can't be guaranteed any more.

Visibility: public
editable boolean true

Flag whether the controls of the Table are editable or not (currently this only controls the background color in certain themes!)

Visibility: public
enableBusyIndicator boolean false

If set to true, the table changes its busy state, resulting in showing or hiding the busy indicator. The table will switch to busy as soon as data is retrieved to be displayed in the currently visible rows. This happens, for example, during scrolling, filtering, or sorting. As soon as the data has been retrieved, the table switches back to not busy. The busy state of the table can still be set manually by calling sap.ui.core.Control#setBusy.

Since: 1.27.0.

Visibility: public
enableCellFilter boolean false

Flag whether to enable or disable the context menu on cells to trigger a filtering with the cell value.

Since: 1.21.0.

Visibility: public
enableColumnFreeze boolean false

Flag whether to show or hide the column menu item to freeze or unfreeze a column.

Since: 1.21.0.

Visibility: public
enableColumnReordering boolean true

Flag to enable or disable column reordering

Visibility: public
enableCustomFilter boolean false

Set this parameter to true to implement your own filter behaviour. Instead of the filter input box a button will be rendered for which' press event (customFilter) you can register an event handler.

Since: 1.23.0.

Visibility: public
enableGrouping boolean false

Enables or disables grouping. If grouping is enabled, the table is grouped by the column which is defined in the groupBy association.

The following restrictions apply:

  • Only client models are supported (e.g. sap.ui.model.json.JSONModel). Grouping does not work with OData models.
  • The table can only be grouped by one column at a time. Grouping by another column will remove the current grouping.
  • For the grouping to work correctly, sortProperty must be set for the grouped column.
  • If grouping has been done, sorting and filtering is not possible. Any existing sorting and filtering rules do no longer apply. The UI is not updated accordingly (e.g. menu items, sort and filter icons).
  • The column, by which the table is grouped, is not visible. It will become visible again only if the table is grouped by another column or grouping is disabled.

Visibility: public
enableSelectAll boolean true

Specifies if a select all button should be displayed in the top left corner. This button is only displayed if the row selector is visible and the selection mode is set to any kind of multi selection.

Since: 1.23.0.

Visibility: public
firstVisibleRow int 0

First visible row.

Visibility: public
fixedBottomRowCount int 0

Number of rows that are fix on the bottom. When you use a vertical scrollbar, only the rows which are not fixed, will scroll.

This property is only supported if the rows aggregation is bound to a client model.

Since: 1.18.7.

Visibility: public
fixedColumnCount int 0

Number of columns that are fixed on the left. Only columns which are not fixed can be scrolled horizontally.

Note

  • Fixed columns need a defined width for the feature to work.
  • The aggregated width of all fixed columns must not exceed the table width. Otherwise the table ignores the value of the property and adapts the behavior in an appropriate way to ensure that the user is still able to scroll horizontally.

Visibility: public
fixedRowCount int 0

Number of rows that are fix on the top. When you use a vertical scrollbar, only the rows which are not fixed, will scroll.

This property is only supported if the rows aggregation is bound to a client model.

Visibility: public
minAutoRowCount int 5

This property is used to set the minimum count of visible rows when the property visibleRowCountMode is set to Auto or Interactive. For any other visibleRowCountMode, it is ignored.

Visibility: public
navigationMode sap.ui.table.NavigationMode Scrollbar

This property has been deprecated and must not be used anymore, since Scrollbar is the only supported option.

Visibility: public
rowActionCount int 0

Number of row actions made visible which determines the width of the row action column. The values 0, 1 and 2 are possible.

Since: 1.45.0.

Visibility: public
rowHeight int

Row height in pixel.

In the table's header, it defines the minimum height of the row, but it cannot be less than the default height based on the content density configuration. The actual height can increase based on the content.

In the table's body, it defines the height of the row content. The actual row height is also influenced by other factors, such as the border width. If the visibleRowCountMode property is set to Fixed or Interactive, the value defines the minimum height, and the actual height can increase based on the content. If the mode is Auto, the value defines the actual height, and any content that doesn't fit is cut off.

If no value is set (includes 0), a default height is applied based on the content density configuration. In any visibleRowCountMode, the actual height can increase based on the content.

Visibility: public
selectedIndex int -1

Zero-based index of selected item. Index value for no selection is -1. When multi-selection is enabled and multiple items are selected, the method returns the lead selected item. Sets the zero-based index of the currently selected item. This method removes any previous selections. When the given index is invalid, the call is ignored. Note: If the rows of the table are bound, the value of the property is reset to -1. If a selection plugin is applied to the table, the property is not bindable.

Visibility: public
selectionBehavior sap.ui.table.SelectionBehavior RowSelector

Selection behavior of the Table. This property defines whether the row selector is displayed and whether the row, the row selector or both can be clicked to select a row. Note: Since the group header visualization relies on the row selectors, the row selectors are always shown if the grouping functionality (depends on table type) is enabled, even if sap.ui.table.SelectionBehavior.RowOnly is set.

Visibility: public
selectionMode sap.ui.table.SelectionMode MultiToggle

Selection mode of the Table. This property controls whether single or multiple rows can be selected and how the selection can be extended. It may also influence the visual appearance. When the selection mode is changed, the current selection is removed. Note: Since the group header visualization relies on the row selectors, the row selectors are always shown if the grouping functionality (depends on table type) is enabled, even if sap.ui.table.SelectionMode.None is set. Note: If a selection plugin is applied to the table, the selection mode is controlled by the plugin.

Visibility: public
showColumnVisibilityMenu boolean false

Flag to show or hide the column visibility menu. This menu will get displayed in each generated column header menu. It allows to show or hide columns

Visibility: public
showNoData boolean true

Flag whether to show the no data overlay or not once the table is empty. If set to false the table will just show a grid of empty cells

Visibility: public
showOverlay boolean false

Setting this property to true will show an overlay on top of the Table content and users cannot click anymore on the Table content.

Since: 1.21.2.

Visibility: public
threshold int 100

The threshold defines how many additional (not yet visible records) shall be pre-fetched to enable smooth scrolling. The threshold is always added to the visibleRowCount. If the visibleRowCount is 10 and the threshold is 100, there will be 110 records fetched with the initial load. If the threshold is lower than the visibleRowCount, the visibleRowCount will be used as the threshold. If the value is 0 then the thresholding is disabled.

Visibility: public
visibleRowCount int 10

Number of visible rows of the table.

Visibility: public
visibleRowCountMode sap.ui.table.VisibleRowCountMode Fixed

Defines how the table handles the visible rows in the table.

In the "Fixed" mode, the table always has as many rows as defined in the visibleRowCount property.

In the "Auto" mode, the visibleRowCount property is changed by the table automatically. It will then adjust its row count to the space it is allowed to cover (limited by the surrounding container), but it cannot have less than defined in the minAutoRowCount property. The visibleRowCount property cannot be set manually.

Restrictions

  • All rows need to have the same height.
  • The table must be rendered without siblings in its parent DOM element. The only exception is if the parent element is a CSS flex container, and the table is a CSS flex item allowed to grow and shrink.

In the "Interactive" mode, the table has as many rows as defined in the visibleRowCount property after rendering. The user can change the visibleRowCount by dragging a resizer.

Since: 1.9.2.

Visibility: public
width sap.ui.core.CSSSize auto

Width of the Table.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
columns 0..n sap.ui.table.Column

Columns of the Table

contextMenu 0..1 sap.ui.core.IContextMenu

Defines the context menu for the table.

Note: The context menu will also be available for the row selectors as well as in the row actions cell of the table control.

The custom context menu will not be shown in group header and summary rows.

If this aggregation is set, then the enableCellFilter property will have no effect.

Since: 1.54.

extension 0..n sap.ui.core.Control

Extension section of the Table. If not set, no extension area will be rendered. Note: In case a sap.m.Toolbar is used as header the CSS class sapMTBHeader-CTX should be applied on this toolbar.

footer 0..1 sap.ui.core.Control

Control or text of footer section of the Table (if not set it will be hidden)

noData 0..1 sap.ui.core.Control

The value for the noData aggregation can be either a string value or a control instance. The control is shown, in case there is no data for the Table available. In case of a string value this will simply replace the no data text.

plugins 0..n sap.ui.table.plugins.SelectionPlugin

Plugin section of the table. Multiple plugins are possible, but always only one of a certain type.

The following restrictions apply:

  • If a selection plugin is applied to the table, the table's selection API must not be used. Instead, use the API of the plugin.
  • Only one MultiSelectionPlugin can be applied. No other plugins can be applied.


Since: 1.64.

rowActionTemplate 0..1 sap.ui.table.RowAction

Template for row actions. A template is decoupled from the row or table. Each time the template's properties or aggregations are changed, the template has to be applied again via setRowActionTemplate for the changes to take effect.

rowSettingsTemplate 0..1 sap.ui.table.RowSettings

Template for row settings. A template is decoupled from the row or table. Each time the template's properties or aggregations are changed, the template has to be applied again via setRowSettingsTemplate for the changes to take effect.

rows 0..n sap.ui.table.Row

This aggregation is managed by the table itself. It can only be used with data binding, is read-only, and does not support templates or factories.

Rows are created and rendered only for a subset of the available data and reused for performance reasons. When scrolling, only the binding contexts are updated to show the correct section of the data. This makes it possible to bind the rows to large data sets. But you must not change rows and their children programmatically, as these changes might get lost when the table updates the rows the next time. Also, properties must not be set to static values, as these would not change when scrolling.

The cells of rows can be defined with the template aggregation of the columns in the columns aggregation of the table. The actions of rows can be defined with the rowActionTemplate aggregation of the table. Furthermore, row-specific settings can be defined with the rowSettingsTemplate aggregation of the table.

title 0..1 sap.ui.core.Control

Control or text of title section of the Table (if not set it will be hidden)
Deprecated as of version 1.72. Use the extension aggregation instead.

toolbar 0..1 sap.ui.core.Toolbar

Toolbar of the Table If not set, no toolbar area will be rendered. Note: The CSS class sapMTBHeader-CTX is applied on the given toolbar.
Deprecated as of version 1.38. This aggregation is deprecated, use the extension aggregation instead.


Events Overview

Event Description
toggleOpenState

Fired when a row has been expanded or collapsed by user interaction. Only available in hierarchical mode.

toggleOpenState

Fired when a row has been expanded or collapsed by user interaction. Only available in hierarchical mode.

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

Index of the expanded/collapsed row

rowContext object

Binding context of the expanded/collapsed row

expanded boolean

Flag that indicates whether the row has been expanded or collapsed


Methods Overview

Method Description
addSelectionInterval

Adds the given selection interval to the selection. In case of single selection, only iIndexTo is added to the selection. Invisible nodes (collapsed child nodes) will not be regarded.

Please also take notice of the fact, that "addSelectionInterval" does not change any other selection. To override the current selection, please use "setSelctionInterval" or for a single entry use "setSelectedIndex".

attachToggleOpenState

Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.table.TreeTable.

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.table.TreeTable itself.

Fired when a row has been expanded or collapsed by user interaction. Only available in hierarchical mode.

collapse

Collapses one or more rows.

collapseAll

Collapses all nodes (and lower if collapseRecursive is activated)

detachToggleOpenState

Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.table.TreeTable.

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

expand

Expands one or more rows.

expandToLevel

Expands all nodes starting from the root level to the given level 'iLevel'.

Only supported with ODataModel v2, when running in OperationMode.Client or OperationMode.Auto. Fully supported for sap.ui.model.ClientTreeBinding, e.g. if you are using a sap.ui.model.json.JSONModel.

Please also see sap.ui.model.odata.OperationMode.

sap.ui.table.TreeTable.extend

Creates a new subclass of class sap.ui.table.TreeTable 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.table.Table.extend.

fireToggleOpenState

Fires event toggleOpenState to attached listeners.

getCollapseRecursive

Gets current value of property collapseRecursive.

Setting collapseRecursive to true means, that when collapsing a node all subsequent child nodes will also be collapsed. This property is only supported with sap.ui.model.odata.v2.ODataModel. Note: collapseRecursive is currently not supported if your OData service exposes the hierarchy annotation hierarchy-descendant-count-for. In this case the value of the collapseRecursive property is ignored. For more information about the OData hierarchy annotations, please see the SAP Annotations for OData Version 2.0 specification.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      collapseRecursive: true
    }
  });

Default value is true.

Since 1.76 replaced by the <code>collapseRecursive</code> binding parameter
getEnableGrouping

The property enableGrouping is not supported by the TreeTable control.

getExpandFirstLevel

Gets current value of property expandFirstLevel.

Specifies whether the first level is expanded.

The value of the property is only taken into account if no parameter numberOfExpandedLevels is given in the binding information. Changes to this property after the table is bound do not have any effect unless an explicit (re-)bind of the rows aggregation is done.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      numberOfExpandedLevels: 1
    }
  });

Default value is false.

Since 1.46.3 replaced by the <code>numberOfExpandedLevels</code> binding parameter
getGroupBy

The groupBy association is not supported by the TreeTable control.

getGroupHeaderProperty

Gets current value of property groupHeaderProperty.

The property name of the rows data which will be displayed as a group header if the group mode is enabled

sap.ui.table.TreeTable.getMetadata

Returns a metadata object for class sap.ui.table.TreeTable.

getRootLevel

Gets current value of property rootLevel.

The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services. This property is only supported when the TreeTable uses an underlying odata services with hierarchy annotations. This property is only supported with sap.ui.model.odata.v2.ODataModel The hierarchy annotations may also be provided locally as a parameter for the ODataTreeBinding.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      rootLevel: 1
    }
  });

Default value is 0.

Since 1.76 replaced by the <code>rootLevel</code> binding parameter
getSelectedIndices

Returns an array containing the row indices of all selected tree nodes (ordered ascending).

Please be aware of the following: Due to performance/network traffic reasons, the getSelectedIndices function returns only all indices of actually selected rows/tree nodes. Unknown rows/nodes (as in "not yet loaded" to the client), will not be returned.

getUseGroupMode

Gets current value of property useGroupMode.

If group mode is enabled nodes with subitems are rendered as if they were group headers. This can be used to do the grouping for an OData service on the backend and visualize this in a table.

Default value is false.

isExpanded

Checks whether the row is expanded or collapsed.

removeSelectionInterval

Removes the given selection interval from the selection. In case of single selection, only iIndexTo is removed from the selection. Invisible nodes (collapsed child nodes) will not be regarded.

selectAll

Selects all available nodes/rows.

All rows/tree nodes that are locally stored on the client and that are part of the currently visible tree are selected. Additional rows or tree nodes that come into view through scrolling or paging are also selected immediately as soon as they get visible. However, SelectAll does not retrieve any data from the back end in order to improve performance and reduce the network traffic.

setCollapseRecursive

Sets a new value for property collapseRecursive.

Setting collapseRecursive to true means, that when collapsing a node all subsequent child nodes will also be collapsed. This property is only supported with sap.ui.model.odata.v2.ODataModel. Note: collapseRecursive is currently not supported if your OData service exposes the hierarchy annotation hierarchy-descendant-count-for. In this case the value of the collapseRecursive property is ignored. For more information about the OData hierarchy annotations, please see the SAP Annotations for OData Version 2.0 specification.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      collapseRecursive: true
    }
  });

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

Default value is true.

Since 1.76 replaced by the <code>collapseRecursive</code> binding parameter
setEnableGrouping

The property enableGrouping is not supported by the TreeTable control.

References:

  • sap.ui.table.TreeTable#setUseGroupMode

Since 1.28 To get a group-like visualization the <code>useGroupMode</code> property can be used.
setExpandFirstLevel

Sets a new value for property expandFirstLevel.

Specifies whether the first level is expanded.

The value of the property is only taken into account if no parameter numberOfExpandedLevels is given in the binding information. Changes to this property after the table is bound do not have any effect unless an explicit (re-)bind of the rows aggregation is done.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      numberOfExpandedLevels: 1
    }
  });

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

Default value is false.

Since 1.46.3 replaced by the <code>numberOfExpandedLevels</code> binding parameter
setFixedRowCount

Setter for property fixedRowCount.

This property is not supportd for the TreeTable and will be ignored!

Default value is 0

setGroupBy

The groupBy association is not supported by the TreeTable control.

setGroupHeaderProperty

Sets a new value for property groupHeaderProperty.

The property name of the rows data which will be displayed as a group header if the group mode is enabled

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

setRootLevel

Sets a new value for property rootLevel.

The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services. This property is only supported when the TreeTable uses an underlying odata services with hierarchy annotations. This property is only supported with sap.ui.model.odata.v2.ODataModel The hierarchy annotations may also be provided locally as a parameter for the ODataTreeBinding.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      rootLevel: 1
    }
  });

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

Default value is 0.

Since 1.76 replaced by the <code>rootLevel</code> binding parameter
setSelectedIndex

Sets the selected index In a TreeTable you can only select indices, which correspond to the currently visualized tree. Invisible tree nodes (e.g. collapsed child nodes) can not be selected via Index, because they do not correspond to a TreeTable row.

setSelectionInterval

Sets the selection of the TreeTable to the given range (including boundaries). Beware: The previous selection will be lost/overridden. If this is not wanted, please use "addSelectionInterval" and "removeSelectionInterval". Please be aware, that the absolute row index only applies to the tree which is visualized by the TreeTable.

setUseFlatMode

Allows to hide the tree structure (tree icons, indentation) in tree mode (property useGroupMode is set to false).

This option might be useful in some scenarios when actually a tree table must be used but under certain conditions the data is not hierarchical, because it contains leafs only.

Note: In flat mode the user of the table cannot expand or collapse certain nodes and the hierarchy is not visible to the user. The caller of this function has to ensure to use this option only with non-hierarchical data.

setUseGroupMode

Sets a new value for property useGroupMode.

If group mode is enabled nodes with subitems are rendered as if they were group headers. This can be used to do the grouping for an OData service on the backend and visualize this in a table.

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

Default value is false.

addSelectionInterval

Adds the given selection interval to the selection. In case of single selection, only iIndexTo is added to the selection. Invisible nodes (collapsed child nodes) will not be regarded.

Please also take notice of the fact, that "addSelectionInterval" does not change any other selection. To override the current selection, please use "setSelctionInterval" or for a single entry use "setSelectedIndex".

Param Type DefaultValue Description
iIndexFrom int

Index from which the selection should start

iIndexTo int

Index up to which to select

attachToggleOpenState

Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.table.TreeTable.

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.table.TreeTable itself.

Fired when a row has been expanded or collapsed by user interaction. Only available in hierarchical mode.

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.table.TreeTable itself

collapse

Collapses one or more rows.

Param Type DefaultValue Description
vRowIndex int int[]

A single index or an array of indices of the rows to be collapsed

collapseAll

Collapses all nodes (and lower if collapseRecursive is activated)

detachToggleOpenState

Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.table.TreeTable.

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

expand

Expands one or more rows.

Param Type DefaultValue Description
vRowIndex int int[]

A single index or an array of indices of the rows to be expanded

expandToLevel

Expands all nodes starting from the root level to the given level 'iLevel'.

Only supported with ODataModel v2, when running in OperationMode.Client or OperationMode.Auto. Fully supported for sap.ui.model.ClientTreeBinding, e.g. if you are using a sap.ui.model.json.JSONModel.

Please also see sap.ui.model.odata.OperationMode.

Param Type DefaultValue Description
iLevel int

the level to which the trees shall be expanded

sap.ui.table.TreeTable.extend

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

fireToggleOpenState

Fires event toggleOpenState to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

rowIndex int

Index of the expanded/collapsed row

rowContext object

Binding context of the expanded/collapsed row

expanded boolean

Flag that indicates whether the row has been expanded or collapsed

getCollapseRecursive

Gets current value of property collapseRecursive.

Setting collapseRecursive to true means, that when collapsing a node all subsequent child nodes will also be collapsed. This property is only supported with sap.ui.model.odata.v2.ODataModel. Note: collapseRecursive is currently not supported if your OData service exposes the hierarchy annotation hierarchy-descendant-count-for. In this case the value of the collapseRecursive property is ignored. For more information about the OData hierarchy annotations, please see the SAP Annotations for OData Version 2.0 specification.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      collapseRecursive: true
    }
  });

Default value is true.

Since 1.76 replaced by the <code>collapseRecursive</code> binding parameter

getEnableGrouping

The property enableGrouping is not supported by the TreeTable control.

getExpandFirstLevel

Gets current value of property expandFirstLevel.

Specifies whether the first level is expanded.

The value of the property is only taken into account if no parameter numberOfExpandedLevels is given in the binding information. Changes to this property after the table is bound do not have any effect unless an explicit (re-)bind of the rows aggregation is done.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      numberOfExpandedLevels: 1
    }
  });

Default value is false.

Since 1.46.3 replaced by the <code>numberOfExpandedLevels</code> binding parameter

getGroupBy

The groupBy association is not supported by the TreeTable control.

getGroupHeaderProperty

Gets current value of property groupHeaderProperty.

The property name of the rows data which will be displayed as a group header if the group mode is enabled

sap.ui.table.TreeTable.getMetadata

Returns a metadata object for class sap.ui.table.TreeTable.

getRootLevel

Gets current value of property rootLevel.

The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services. This property is only supported when the TreeTable uses an underlying odata services with hierarchy annotations. This property is only supported with sap.ui.model.odata.v2.ODataModel The hierarchy annotations may also be provided locally as a parameter for the ODataTreeBinding.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      rootLevel: 1
    }
  });

Default value is 0.

Since 1.76 replaced by the <code>rootLevel</code> binding parameter

getSelectedIndices

Returns an array containing the row indices of all selected tree nodes (ordered ascending).

Please be aware of the following: Due to performance/network traffic reasons, the getSelectedIndices function returns only all indices of actually selected rows/tree nodes. Unknown rows/nodes (as in "not yet loaded" to the client), will not be returned.

getUseGroupMode

Gets current value of property useGroupMode.

If group mode is enabled nodes with subitems are rendered as if they were group headers. This can be used to do the grouping for an OData service on the backend and visualize this in a table.

Default value is false.

isExpanded

Checks whether the row is expanded or collapsed.

Param Type DefaultValue Description
iRowIndex int

The index of the row to be checked

removeSelectionInterval

Removes the given selection interval from the selection. In case of single selection, only iIndexTo is removed from the selection. Invisible nodes (collapsed child nodes) will not be regarded.

Param Type DefaultValue Description
iIndexFrom int

Index from which the deselection should start

iIndexTo int

Index up to which to deselect

selectAll

Selects all available nodes/rows.

All rows/tree nodes that are locally stored on the client and that are part of the currently visible tree are selected. Additional rows or tree nodes that come into view through scrolling or paging are also selected immediately as soon as they get visible. However, SelectAll does not retrieve any data from the back end in order to improve performance and reduce the network traffic.

setCollapseRecursive

Sets a new value for property collapseRecursive.

Setting collapseRecursive to true means, that when collapsing a node all subsequent child nodes will also be collapsed. This property is only supported with sap.ui.model.odata.v2.ODataModel. Note: collapseRecursive is currently not supported if your OData service exposes the hierarchy annotation hierarchy-descendant-count-for. In this case the value of the collapseRecursive property is ignored. For more information about the OData hierarchy annotations, please see the SAP Annotations for OData Version 2.0 specification.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      collapseRecursive: true
    }
  });

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

Default value is true.

Since 1.76 replaced by the <code>collapseRecursive</code> binding parameter
Param Type DefaultValue Description
bCollapseRecursive boolean true

New value for property collapseRecursive

setEnableGrouping

The property enableGrouping is not supported by the TreeTable control.

References:

Since 1.28 To get a group-like visualization the <code>useGroupMode</code> property can be used.
Param Type DefaultValue Description
bValue boolean

setExpandFirstLevel

Sets a new value for property expandFirstLevel.

Specifies whether the first level is expanded.

The value of the property is only taken into account if no parameter numberOfExpandedLevels is given in the binding information. Changes to this property after the table is bound do not have any effect unless an explicit (re-)bind of the rows aggregation is done.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      numberOfExpandedLevels: 1
    }
  });

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

Default value is false.

Since 1.46.3 replaced by the <code>numberOfExpandedLevels</code> binding parameter
Param Type DefaultValue Description
bExpandFirstLevel boolean false

New value for property expandFirstLevel

setFixedRowCount

Setter for property fixedRowCount.

This property is not supportd for the TreeTable and will be ignored!

Default value is 0

Param Type DefaultValue Description
iRowCount int

New value for property fixedRowCount

setGroupBy

The groupBy association is not supported by the TreeTable control.

Param Type DefaultValue Description
oColumn sap.ui.table.Column sap.ui.core.ID

setGroupHeaderProperty

Sets a new value for property groupHeaderProperty.

The property name of the rows data which will be displayed as a group header if the group mode is enabled

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

Param Type DefaultValue Description
sGroupHeaderProperty string

New value for property groupHeaderProperty

setRootLevel

Sets a new value for property rootLevel.

The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services. This property is only supported when the TreeTable uses an underlying odata services with hierarchy annotations. This property is only supported with sap.ui.model.odata.v2.ODataModel The hierarchy annotations may also be provided locally as a parameter for the ODataTreeBinding.

Example:

  oTable.bindRows({
    path: "...",
    parameters: {
      rootLevel: 1
    }
  });

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

Default value is 0.

Since 1.76 replaced by the <code>rootLevel</code> binding parameter
Param Type DefaultValue Description
iRootLevel int 0

New value for property rootLevel

setSelectedIndex

Sets the selected index In a TreeTable you can only select indices, which correspond to the currently visualized tree. Invisible tree nodes (e.g. collapsed child nodes) can not be selected via Index, because they do not correspond to a TreeTable row.

Param Type DefaultValue Description
iRowIndex int

The row index which will be selected (if existing)

setSelectionInterval

Sets the selection of the TreeTable to the given range (including boundaries). Beware: The previous selection will be lost/overridden. If this is not wanted, please use "addSelectionInterval" and "removeSelectionInterval". Please be aware, that the absolute row index only applies to the tree which is visualized by the TreeTable.

Param Type DefaultValue Description
iFromIndex int

the start index of the selection range

iToIndex int

the end index of the selection range

setUseFlatMode

Allows to hide the tree structure (tree icons, indentation) in tree mode (property useGroupMode is set to false).

This option might be useful in some scenarios when actually a tree table must be used but under certain conditions the data is not hierarchical, because it contains leafs only.

Note: In flat mode the user of the table cannot expand or collapse certain nodes and the hierarchy is not visible to the user. The caller of this function has to ensure to use this option only with non-hierarchical data.

Param Type DefaultValue Description
bFlat boolean

If set to true, the flat mode is enabled

setUseGroupMode

Sets a new value for property useGroupMode.

If group mode is enabled nodes with subitems are rendered as if they were group headers. This can be used to do the grouping for an OData service on the backend and visualize this in a table.

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
bUseGroupMode boolean false

New value for property useGroupMode