Class sap.ui.table.TreeTableModule: sap/ui/table/TreeTable

extends Table

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

Constructor Summary
new sap.ui.table.TreeTable(sId?, mSettings?)Constructor for a new TreeTable.
Event Summary
toggleOpenState(oControlEvent)fired when a node has been expanded or collapsed (only available in hierachical mode)
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.table.TreeTable.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.table.TreeTable with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.table.TreeTable.getMetadata()Returns a metadata object for class sap.ui.table.TreeTable.
addSelectionInterval(iFromIndex, iToIndex)Marks a range of tree nodes as selected, starting with iFromIndex going to iToIndex.
attachToggleOpenState(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.table.TreeTable.
clearSelection()Clears the complete selection (all tree table rows/nodes will lose their selection)
collapse(iRowIndex)collapses the row for the given row index
collapseAll()Collapses all nodes (and lower if collapseRecursive is activated)
detachToggleOpenState(fnFunction, oListener)Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.table.TreeTable.
expand(iRowIndex)expands the row for the given row index
expandToLevel(iLevel)Expands all nodes starting from the root level to the given level 'iLevel'.
fireToggleOpenState(mArguments?)Fires event toggleOpenState to attached listeners.
getCollapseRecursive()Gets current value of property collapseRecursive.
getExpandFirstLevel()Gets current value of property expandFirstLevel.
getGroupHeaderProperty()Gets current value of property groupHeaderProperty.
getRootLevel()Gets current value of property rootLevel.
getSelectedIndex()Retrieves the lead selection index.
getSelectedIndices()Returns an array containing the row indices of all selected tree nodes (ordered ascending).
getUseGroupMode()Gets current value of property useGroupMode.
isExpanded(iRowIndex)Returns whether the row is expanded or collapsed.
isIndexSelected(iRowIndex)Checks if the row at the given index is selected.
removeSelectionInterval(iFromIndex, iToIndex)All rows/tree nodes inside the range (including boundaries) will be deselected.
selectAll()Selects all available nodes/rows.
setExpandFirstLevel(bExpandFirstLevel)Sets a new value for property expandFirstLevel.
setFixedRowCount(iFixedRowCount)Setter for property fixedRowCount.
setGroupHeaderProperty(sGroupHeaderProperty)Sets a new value for property groupHeaderProperty.
setSelectedIndex(iRowIndex)Overriden from Table.js base class.
setSelectionInterval(iFromIndex, iToIndex)Sets the selection of the TreeTable to the given range (including boundaries).
setSelectionMode(sSelectionMode)Sets the selection mode.
setUseGroupMode(bUseGroupMode)Sets a new value for property useGroupMode.
Methods borrowed from class sap.ui.table.Table
addAriaLabelledBy, addColumn, addExtension, addRow, attachBusyStateChanged, attachCellClick, attachCellContextmenu, attachColumnFreeze, attachColumnMove, attachColumnResize, attachColumnSelect, attachColumnVisibility, attachCustomFilter, attachFilter, attachFirstVisibleRowChanged, attachGroup, attachRowSelectionChange, attachSort, autoResizeColumn, bindColumns, bindRows, destroyColumns, destroyExtension, destroyFooter, destroyNoData, destroyRows, destroyTitle, destroyToolbar, detachBusyStateChanged, detachCellClick, detachCellContextmenu, detachColumnFreeze, detachColumnMove, detachColumnResize, detachColumnSelect, detachColumnVisibility, detachCustomFilter, detachFilter, detachFirstVisibleRowChanged, detachGroup, detachRowSelectionChange, detachSort, exportData, filter, fireBusyStateChanged, fireCellClick, fireCellContextmenu, fireColumnFreeze, fireColumnMove, fireColumnResize, fireColumnSelect, fireColumnVisibility, fireCustomFilter, fireFilter, fireFirstVisibleRowChanged, fireGroup, fireRowSelectionChange, fireSort, getAriaLabelledBy, getColumnHeaderHeight, getColumnHeaderVisible, getColumns, getContextByIndex, getEditable, getEnableBusyIndicator, getEnableCellFilter, getEnableColumnFreeze, getEnableColumnReordering, getEnableCustomFilter, getEnableGrouping, getEnableSelectAll, getExtension, getFirstVisibleRow, getFixedBottomRowCount, getFixedColumnCount, getFixedRowCount, getFooter, getGroupBy, getMinAutoRowCount, getNavigationMode, getNoData, getRowHeight, getRows, getSelectionBehavior, getSelectionMode, getShowColumnVisibilityMenu, getShowNoData, getShowOverlay, getSortedColumns, getThreshold, getTitle, getToolbar, getVisibleRowCount, getVisibleRowCountMode, getWidth, indexOfColumn, indexOfExtension, indexOfRow, insertColumn, insertExtension, insertRow, removeAllAriaLabelledBy, removeAllColumns, removeAllExtension, removeAllRows, removeAriaLabelledBy, removeColumn, removeExtension, removeRow, setColumnHeaderHeight, setColumnHeaderVisible, setEditable, setEnableBusyIndicator, setEnableCellFilter, setEnableColumnFreeze, setEnableColumnReordering, setEnableCustomFilter, setEnableSelectAll, setFirstVisibleRow, setFixedBottomRowCount, setFixedColumnCount, setFooter, setGroupBy, setMinAutoRowCount, setNavigationMode, setNoData, setRowHeight, setSelectionBehavior, setShowColumnVisibilityMenu, setShowNoData, setShowOverlay, setThreshold, setTitle, setToolbar, setVisibleRowCount, setVisibleRowCountMode, setWidth, sort, unbindColumns, unbindRows
Constructor Detail
new sap.ui.table.TreeTable(sId?, mSettings?)
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 for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.ui.table.Table can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Event Detail
toggleOpenState(oControlEvent)
fired when a node has been expanded or collapsed (only available in hierachical mode)
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{int}oControlEvent.getParameters.rowIndex index of the expanded/collapsed row
{object}oControlEvent.getParameters.rowContext binding context of the selected row
{boolean}oControlEvent.getParameters.expanded flag whether the node has been expanded or collapsed
Method Detail
sap.ui.table.TreeTable.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.table.TreeTable.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.table.TreeTable.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addSelectionInterval(iFromIndex, iToIndex): sap.ui.table.TreeTable
Marks a range of tree nodes as selected, starting with iFromIndex going to iToIndex. The TreeNodes are referenced via their absolute row index. Please be aware, that the absolute row index only applies to the the tree which is visualized by the TreeTable. 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".

Parameters:
{int}iFromIndex The starting index of the range which will be selected.
{int}iToIndex The starting index of the range which will be selected.
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
attachToggleOpenState(oData?, fnFunction, oListener?): sap.ui.table.TreeTable
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 node has been expanded or collapsed (only available in hierachical mode)

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.table.TreeTable itself
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining
clearSelection(): sap.ui.table.TreeTable
Clears the complete selection (all tree table rows/nodes will lose their selection)
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
collapse(iRowIndex): sap.ui.table.TreeTable
collapses the row for the given row index
Parameters:
{int}iRowIndex index of the row to collapse
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
collapseAll(): sap.ui.table.TreeTable
Collapses all nodes (and lower if collapseRecursive is activated)
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
detachToggleOpenState(fnFunction, oListener): sap.ui.table.TreeTable
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.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining
expand(iRowIndex): sap.ui.table.TreeTable
expands the row for the given row index
Parameters:
{int}iRowIndex index of the row to expand
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
expandToLevel(iLevel): sap.ui.table.TreeTable
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.

Parameters:
{int}iLevel the level to which the trees shall be expanded
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
fireToggleOpenState(mArguments?): sap.ui.table.TreeTable
Fires event toggleOpenState to attached listeners.

Expects the following event parameters:

  • rowIndex of type intindex of the expanded/collapsed row
  • rowContext of type objectbinding context of the selected row
  • expanded of type booleanflag whether the node has been expanded or collapsed
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining
getCollapseRecursive(): boolean
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

Default value is true.

Returns:
{boolean} Value of property collapseRecursive
getExpandFirstLevel(): boolean
Gets current value of property expandFirstLevel.

Flag to enable or disable expanding of first level.

Default value is false.

Returns:
{boolean} Value of property expandFirstLevel
getGroupHeaderProperty(): string
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

Returns:
{string} Value of property groupHeaderProperty
getRootLevel(): int
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.

Default value is 0.

Returns:
{int} Value of property rootLevel
getSelectedIndex(): int[]
Retrieves the lead selection index. The lead selection index is, among other things, used to determine the start/end of a selection range, when using Shift-Click to select multiple entries at once.
Returns:
{int[]} an array containing all selected indices (ascending ordered integers)
getSelectedIndices(): int[]
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.

Returns:
{int[]} an array containing all selected indices
getUseGroupMode(): boolean
Gets current value of property useGroupMode.

If group mode is enable 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. This mode only makes sense if the tree has a depth of exacly 1 (group headers and entries)

Default value is false.

Returns:
{boolean} Value of property useGroupMode
isExpanded(iRowIndex): boolean
Returns whether the row is expanded or collapsed.
Parameters:
{int}iRowIndex index of the row to check
Returns:
{boolean} true if the node at "iRowIndex" is expanded, false otherwise (meaning it is collapsed)
isIndexSelected(iRowIndex): boolean
Checks if the row at the given index is selected.
Parameters:
{int}iRowIndex The row index for which the selection state should be retrieved
Returns:
{boolean} true if the index is selected, false otherwise
removeSelectionInterval(iFromIndex, iToIndex): sap.ui.table.TreeTable
All rows/tree nodes inside the range (including boundaries) will be deselected. Tree nodes are referenced with theit absolute row index inside the tree- Please be aware, that the absolute row index only applies to the the tree which is visualized by the TreeTable. Invisible nodes (collapsed child nodes) will not be regarded.
Parameters:
{int}iFromIndex The starting index of the range which will be deselected.
{int}iToIndex The starting index of the range which will be deselected.
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
Selects all available nodes/rows.

Explanation of the SelectAll function and what to expect from its behavior: All rows/tree nodes locally stored on the client are selected. In addition all subsequent rows/tree nodes, which will be paged into view are also immediatly selected. However, due to obvious performance/network traffic reasons, the SelectAll function will NOT retrieve any data from the backend.

Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
setExpandFirstLevel(bExpandFirstLevel): sap.ui.table.TreeTable
Sets a new value for property expandFirstLevel.

Flag to enable or disable expanding of first level.

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

Default value is false.

Parameters:
{boolean}bExpandFirstLevel New value for property expandFirstLevel
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining
setFixedRowCount(iFixedRowCount): sap.ui.table.TreeTable
Setter for property fixedRowCount.

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

Default value is 0

Parameters:
{int}iFixedRowCount new value for property fixedRowCount
Returns:
{sap.ui.table.TreeTable}this to allow method chaining
setGroupHeaderProperty(sGroupHeaderProperty): sap.ui.table.TreeTable
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.

Parameters:
{string}sGroupHeaderProperty New value for property groupHeaderProperty
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining
setSelectedIndex(iRowIndex): sap.ui.table.TreeTable
Overriden from Table.js base class. 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.
Parameters:
{int}iRowIndex The row index which will be selected (if existing)
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
setSelectionInterval(iFromIndex, iToIndex): sap.ui.table.TreeTable
Sets the selection of the TreeTable to the given range (including boundaries). Beware: The previous selection will be lost/overriden. If this is not wanted, please use "addSelectionInterval" and "removeSelectionIntervall".
Parameters:
{int}iFromIndex the start index of the selection range
{int}iToIndex the end index of the selection range
Returns:
{sap.ui.table.TreeTable} a reference on the TreeTable control, can be used for chaining
setSelectionMode(sSelectionMode)
Sets the selection mode. The current selection is lost.
Parameters:
{string}sSelectionMode the selection mode, see sap.ui.table.SelectionMode
setUseGroupMode(bUseGroupMode): sap.ui.table.TreeTable
Sets a new value for property useGroupMode.

If group mode is enable 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. This mode only makes sense if the tree has a depth of exacly 1 (group headers and entries)

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

Default value is false.

Parameters:
{boolean}bUseGroupMode New value for property useGroupMode
Returns:
{sap.ui.table.TreeTable} Reference to this in order to allow method chaining