Class sap.m.TabContainerModule: sap/m/TabContainer

extends Control

The TabContainer control represents a collection of tabs with associated content.


Since: 1.34.
Constructor Summary
new sap.m.TabContainer(sId?, mSettings?)Constructor for a new TabContainer.
Event Summary
addNewButtonPress(oControlEvent)Fired when Add New Tab button is pressed.
itemClose(oControlEvent)Fired when an item is closed.
itemSelect(oControlEvent)Fired when an item is pressed.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.TabContainer.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.TabContainer with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.TabContainer.getMetadata()Returns a metadata object for class sap.m.TabContainer.
_toTabStripItem(vItem)Finds the sap.m.TabStripItem corresponding to a given sap.m.TabContainerItem.
attachAddNewButtonPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the addNewButtonPress event of this sap.m.TabContainer.
attachItemClose(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the itemClose event of this sap.m.TabContainer.
attachItemSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the itemSelect event of this sap.m.TabContainer.
bindItems(oBindingInfo)Binds aggregation items to model data.
detachAddNewButtonPress(fnFunction, oListener)Detaches event handler fnFunction from the addNewButtonPress event of this sap.m.TabContainer.
detachItemClose(fnFunction, oListener)Detaches event handler fnFunction from the itemClose event of this sap.m.TabContainer.
detachItemSelect(fnFunction, oListener)Detaches event handler fnFunction from the itemSelect event of this sap.m.TabContainer.
fireAddNewButtonPress(mArguments?)Fires event addNewButtonPress to attached listeners.
fireItemClose(mArguments?)Fires event itemClose to attached listeners.
fireItemSelect(mArguments?)Fires event itemSelect to attached listeners.
getItems()Gets content of aggregation items.
getSelectedItem()ID of the element which is the current target of the association selectedItem, or null.
getShowAddNewButton()Gets current value of property showAddNewButton.
indexOfItem(oItem)Checks for the provided sap.m.TabContainerItem in the aggregation items.
removeItem(vItem)Removes an item from the aggregation named items.
unbindItems()Unbinds aggregation items from model data.
Constructor Detail
new sap.m.TabContainer(sId?, mSettings?)
Constructor for a new TabContainer.

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
    • items : sap.m.TabContainerItem[]
  • Events
    • itemClose : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • itemSelect : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • addNewButtonPress : 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
Event Detail
addNewButtonPress(oControlEvent)
Fired when Add New Tab button is pressed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
itemClose(oControlEvent)
Fired when an item is closed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.m.TabContainerItem}oControlEvent.getParameters.item The item to be closed.
itemSelect(oControlEvent)
Fired when an item is pressed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.m.TabContainerItem}oControlEvent.getParameters.item The selected item.
Method Detail
sap.m.TabContainer.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.TabContainer 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.m.TabContainer.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.TabContainer.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
_toTabStripItem(vItem): sap.m.TabStripItem|null
Finds the sap.m.TabStripItem corresponding to a given sap.m.TabContainerItem.
Parameters:
{sap.m.TabContainerItem|string}vItem object or ID of the TabContainerItem
Returns:
{sap.m.TabStripItem|null}TabStripItem corresponding to a given sap.m.TabContainerItem (if any)
attachAddNewButtonPress(oData?, fnFunction, oListener?): sap.m.TabContainer
Attaches event handler fnFunction to the addNewButtonPress event of this sap.m.TabContainer.

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.m.TabContainer itself.

Fired when Add New Tab button is pressed.

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.m.TabContainer itself
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining
attachItemClose(oData?, fnFunction, oListener?): sap.m.TabContainer
Attaches event handler fnFunction to the itemClose event of this sap.m.TabContainer.

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.m.TabContainer itself.

Fired when an item is closed.

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.m.TabContainer itself
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining
attachItemSelect(oData?, fnFunction, oListener?): sap.m.TabContainer
Attaches event handler fnFunction to the itemSelect event of this sap.m.TabContainer.

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.m.TabContainer itself.

Fired when an item is pressed.

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.m.TabContainer itself
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining
bindItems(oBindingInfo): sap.m.TabContainer
Binds aggregation items to model data.

See ManagedObject.bindAggregation for a detailed description of the possible properties of oBindingInfo.

Parameters:
{object}oBindingInfo The binding information
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining
detachAddNewButtonPress(fnFunction, oListener): sap.m.TabContainer
Detaches event handler fnFunction from the addNewButtonPress event of this sap.m.TabContainer.

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.m.TabContainer} Reference to this in order to allow method chaining
detachItemClose(fnFunction, oListener): sap.m.TabContainer
Detaches event handler fnFunction from the itemClose event of this sap.m.TabContainer.

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.m.TabContainer} Reference to this in order to allow method chaining
detachItemSelect(fnFunction, oListener): sap.m.TabContainer
Detaches event handler fnFunction from the itemSelect event of this sap.m.TabContainer.

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.m.TabContainer} Reference to this in order to allow method chaining
fireAddNewButtonPress(mArguments?): sap.m.TabContainer
Fires event addNewButtonPress to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining
fireItemClose(mArguments?): boolean
Fires event itemClose to attached listeners.

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

Expects the following event parameters:

  • item of type sap.m.TabContainerItemThe item to be closed.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{boolean} Whether or not to prevent the default action
fireItemSelect(mArguments?): boolean
Fires event itemSelect to attached listeners.

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

Expects the following event parameters:

  • item of type sap.m.TabContainerItemThe selected item.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{boolean} Whether or not to prevent the default action
getItems(): sap.m.TabContainerItem[]
Gets content of aggregation items.

The items displayed in the TabContainer.

Returns:
{sap.m.TabContainerItem[]}
getSelectedItem(): sap.m.TabContainerItem
ID of the element which is the current target of the association selectedItem, or null.
Returns:
{sap.m.TabContainerItem}
getShowAddNewButton(): boolean
Gets current value of property showAddNewButton.

Defines whether an Add New Tab button is displayed in the TabStrip.

Default value is false.

Returns:
{boolean} Value of property showAddNewButton
indexOfItem(oItem): int
Checks for the provided sap.m.TabContainerItem in the aggregation items. and returns its index if found or -1 otherwise.
Parameters:
{sap.m.TabContainerItem}oItem The item whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
removeItem(vItem): sap.m.TabContainerItem
Removes an item from the aggregation named items.
Parameters:
{int|string|sap.m.TabContainerItem}vItem The item to remove or its index or ID
Returns:
{sap.m.TabContainerItem} The removed item or null
unbindItems(): sap.m.TabContainer
Unbinds aggregation items from model data.
Returns:
{sap.m.TabContainer} Reference to this in order to allow method chaining