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

extends Control

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

The TabContainer is a full-page container that takes 100% of the parent width and height. As the control is expected to occupy the whole parent, it should be the only child of its parent.


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.
addItem(oItem)Adds some item to the aggregation items.
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.
destroyItems()Destroys all the items in the aggregation items.
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(mParameters?)Fires event addNewButtonPress to attached listeners.
fireItemClose(mParameters?)Fires event itemClose to attached listeners.
fireItemSelect(mParameters?)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.
insertItem(oItem, iIndex)Inserts a item into the aggregation items.
removeAllItems()Removes all the controls from the aggregation items.
removeItem(vItem)Removes an item from the aggregation named items.
setSelectedItem(oSelectedItem)Sets the associated selectedItem.
setShowAddNewButton(bShowAddNewButton)Sets a new value for property showAddNewButton.
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[]

  • Associations

  • 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:
stringsId?ID for the new control, generated automatically if no ID is given
objectmSettings?Initial settings for the new control
Event Detail
addNewButtonPress(oControlEvent)
Fired when Add New Tab button is pressed.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
itemClose(oControlEvent)
Fired when an item is closed.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
sap.m.TabContainerItemoControlEvent.getParameters.itemThe item to be closed.
itemSelect(oControlEvent)
Fired when an item is pressed.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
sap.m.TabContainerItemoControlEvent.getParameters.itemThe 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:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated class / constructor function
sap.m.TabContainer.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.TabContainer.
Returns:
sap.ui.base.MetadataMetadata object describing this class
addItem(oItem): sap.m.TabContainer
Adds some item to the aggregation items.
Parameters:
sap.m.TabContainerItemoItemthe item to add; if empty, nothing is inserted
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.TabContainer itself
Returns:
sap.m.TabContainerReference 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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.TabContainer itself
Returns:
sap.m.TabContainerReference 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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.TabContainer itself
Returns:
sap.m.TabContainerReference 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:
objectoBindingInfoThe binding information
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
destroyItems(): sap.m.TabContainer
Destroys all the items in the aggregation items.
Returns:
sap.m.TabContainerReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.TabContainerReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.TabContainerReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
fireAddNewButtonPress(mParameters?): sap.m.TabContainer
Fires event addNewButtonPress to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
fireItemClose(mParameters?): 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.

Parameters:
objectmParameters?Parameters to pass along with the event
sap.m.TabContainerItemmParameters.item?The item to be closed.
Returns:
booleanWhether or not to prevent the default action
fireItemSelect(mParameters?): 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.

Parameters:
objectmParameters?Parameters to pass along with the event
sap.m.TabContainerItemmParameters.item?The selected item.
Returns:
booleanWhether 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.ui.core.ID
ID of the element which is the current target of the association selectedItem, or null.
Returns:
sap.ui.core.ID
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:
booleanValue 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.TabContainerItemoItemThe item whose index is looked for
Returns:
intThe index of the provided control in the aggregation if found, or -1 otherwise
insertItem(oItem, iIndex): sap.m.TabContainer
Inserts a item into the aggregation items.
Parameters:
sap.m.TabContainerItemoItemthe item to insert; if empty, nothing is inserted
intiIndexthe 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
removeAllItems(): sap.m.TabContainerItem[]

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

Returns:
sap.m.TabContainerItem[]An array of the removed elements (might be empty)
removeItem(vItem): sap.m.TabContainerItem
Removes an item from the aggregation named items.
Parameters:
int|string|sap.m.TabContainerItemvItemThe item to remove or its index or ID
Returns:
sap.m.TabContainerItemThe removed item or null
setSelectedItem(oSelectedItem): sap.m.TabContainer
Sets the associated selectedItem.
Parameters:
sap.ui.core.ID|sap.m.TabContainerItemoSelectedItemID of an element which becomes the new target of this selectedItem association; alternatively, an element instance may be given
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
setShowAddNewButton(bShowAddNewButton): sap.m.TabContainer

Sets a new value for property showAddNewButton.

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

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

Default value is false.

Parameters:
booleanbShowAddNewButtonNew value for property showAddNewButton
Returns:
sap.m.TabContainerReference to this in order to allow method chaining
unbindItems(): sap.m.TabContainer
Unbinds aggregation items from model data.
Returns:
sap.m.TabContainerReference to this in order to allow method chaining