Class sap.ui.commons.TabStripModule: sap/ui/commons/TabStrip

extends Control

TabStrip represents a container for tab controls, which contain the content and generally other controls. The user switches between the tabs to display the content.

Deprecated API:Since version 1.38. Instead, use the sap.m.TabContainer control.

Constructor Summary
new sap.ui.commons.TabStrip(sId?, mSettings?)Constructor for a new TabStrip.
Event Summary
close(oControlEvent)Fires when the user closes a tab.
select(oControlEvent)Fires when the user selects a tab.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.TabStrip.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.TabStrip with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.TabStrip.getMetadata()Returns a metadata object for class sap.ui.commons.TabStrip.
addTab(oTab)Adds some tab to the aggregation tabs.
attachClose(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the close event of this sap.ui.commons.TabStrip.
attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the select event of this sap.ui.commons.TabStrip.
closeTab(iIndex)Closes a tab (if the tab is selected, the next one will be selected; if it's the last tab, the previous one will be selected).
createTab(sText, oContent)Creates a Tab and adds it to the TabStrip.
destroyTabs()Destroys all the tabs in the aggregation tabs.
detachClose(fnFunction, oListener)Detaches event handler fnFunction from the close event of this sap.ui.commons.TabStrip.
detachSelect(fnFunction, oListener)Detaches event handler fnFunction from the select event of this sap.ui.commons.TabStrip.
fireClose(mArguments?)Fires event close to attached listeners.
fireSelect(mArguments?)Fires event select to attached listeners.
getEnableTabReordering()Gets current value of property enableTabReordering.
getHeight()Gets current value of property height.
getSelectedIndex()Gets current value of property selectedIndex.
getTabs()Gets content of aggregation tabs.
getWidth()Gets current value of property width.
indexOfTab(oTab)Checks for the provided sap.ui.commons.Tab in the aggregation tabs.
insertTab(oTab, iIndex)Inserts a tab into the aggregation tabs.
removeAllTabs()Removes all the controls from the aggregation tabs.
removeTab(vTab)Removes a tab from the aggregation tabs.
setEnableTabReordering(bValue)Sets whether tab reordering is enabled.
setHeight(sHeight)Sets a new value for property height.
setSelectedIndex(iSelectedIndex)Sets a new value for property selectedIndex.
setWidth(sWidth)Sets a new value for property width.
Constructor Detail
new sap.ui.commons.TabStrip(sId?, mSettings?)
Constructor for a new TabStrip.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Aggregations
    • tabs : sap.ui.commons.Tab[] (default)
  • Events
    • select : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • close : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

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

Parameters:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? Initial settings for the new control
Deprecated:
Since version 1.38. Instead, use the sap.m.TabContainer control.
Event Detail
close(oControlEvent)
Fires when the user closes a tab.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{int}oControlEvent.getParameters.index The index of the closed tab.
select(oControlEvent)
Fires when the user selects a tab.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{int}oControlEvent.getParameters.index The index of the selected tab.
Method Detail
sap.ui.commons.TabStrip.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.TabStrip with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.commons.TabStrip.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.TabStrip.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
Adds some tab to the aggregation tabs.
Parameters:
{sap.ui.commons.Tab}oTab the tab to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
attachClose(oData?, fnFunction, oListener?): sap.ui.commons.TabStrip
Attaches event handler fnFunction to the close event of this sap.ui.commons.TabStrip.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TabStrip itself.

Fires when the user closes a tab.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.TabStrip itself
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
attachSelect(oData?, fnFunction, oListener?): sap.ui.commons.TabStrip
Attaches event handler fnFunction to the select event of this sap.ui.commons.TabStrip.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TabStrip itself.

Fires when the user selects a tab.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.TabStrip itself
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
closeTab(iIndex): void
Closes a tab (if the tab is selected, the next one will be selected; if it's the last tab, the previous one will be selected).

This method should be called if the close event is fired. It can not be called automatically because the consumer might need to run some logic before the tab is closed.

Parameters:
{int}iIndex The index of the tab that should be closed
createTab(sText, oContent): sap.ui.commons.Tab
Creates a Tab and adds it to the TabStrip.
Parameters:
{string}sText Defines the title text of the newly created tab
{sap.ui.core.Control}oContent Defines the root control of the content area
Returns:
{sap.ui.commons.Tab} oTab The created tab control
destroyTabs(): sap.ui.commons.TabStrip
Destroys all the tabs in the aggregation tabs.
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
detachClose(fnFunction, oListener): sap.ui.commons.TabStrip
Detaches event handler fnFunction from the close event of this sap.ui.commons.TabStrip.

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.commons.TabStrip} Reference to this in order to allow method chaining
detachSelect(fnFunction, oListener): sap.ui.commons.TabStrip
Detaches event handler fnFunction from the select event of this sap.ui.commons.TabStrip.

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.commons.TabStrip} Reference to this in order to allow method chaining
fireClose(mArguments?): sap.ui.commons.TabStrip
Fires event close to attached listeners.

Expects the following event parameters:

  • index of type intThe index of the closed tab.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
fireSelect(mArguments?): sap.ui.commons.TabStrip
Fires event select to attached listeners.

Expects the following event parameters:

  • index of type intThe index of the selected tab.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
getEnableTabReordering(): boolean
Gets current value of property enableTabReordering.

Specifies whether tab reordering is enabled.

Default value is false.

Returns:
{boolean} Value of property enableTabReordering
getHeight(): sap.ui.core.CSSSize
Gets current value of property height.

Specifies the height of the tab bar and content area.

Returns:
{sap.ui.core.CSSSize} Value of property height
getSelectedIndex(): int
Gets current value of property selectedIndex.

Specifies the index of the currently selected tab.

Default value is 0.

Returns:
{int} Value of property selectedIndex
getTabs(): sap.ui.commons.Tab[]
Gets content of aggregation tabs.

The tabs contained in the TabStrip.

Returns:
{sap.ui.commons.Tab[]}
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

Specifies the width of the bar and content area.

Returns:
{sap.ui.core.CSSSize} Value of property width
indexOfTab(oTab): int
Checks for the provided sap.ui.commons.Tab in the aggregation tabs. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.commons.Tab}oTab The tab whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertTab(oTab, iIndex): sap.ui.commons.TabStrip
Inserts a tab into the aggregation tabs.
Parameters:
{sap.ui.commons.Tab}oTab the tab to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the tab should be inserted at; for a negative value of iIndex, the tab is inserted at position 0; for a value greater than the current size of the aggregation, the tab is inserted at the last position
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
removeAllTabs(): sap.ui.commons.Tab[]
Removes all the controls from the aggregation tabs.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.commons.Tab[]} An array of the removed elements (might be empty)
removeTab(vTab): sap.ui.commons.Tab
Removes a tab from the aggregation tabs.
Parameters:
{int|string|sap.ui.commons.Tab}vTab The tabto remove or its index or id
Returns:
{sap.ui.commons.Tab} The removed tab or null
setEnableTabReordering(bValue): sap.ui.commons.TabStrip
Sets whether tab reordering is enabled.
Parameters:
{boolean}bValue The value.
Returns:
{sap.ui.commons.TabStrip} Pointer to the control instance for chaining.
setHeight(sHeight): sap.ui.commons.TabStrip
Sets a new value for property height.

Specifies the height of the tab bar and content area.

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

Parameters:
{sap.ui.core.CSSSize}sHeight New value for property height
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
setSelectedIndex(iSelectedIndex): sap.ui.commons.TabStrip
Sets a new value for property selectedIndex.

Specifies the index of the currently selected tab.

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

Default value is 0.

Parameters:
{int}iSelectedIndex New value for property selectedIndex
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.TabStrip
Sets a new value for property width.

Specifies the width of the bar and content area.

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

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.TabStrip} Reference to this in order to allow method chaining