Class sap.m.ToolbarModule: sap/m/Toolbar
The Toolbar control is a horizontal container that is most commonly used to display buttons, labels, selects and various other input controls.
By default, Toolbar items are shrinkable if they have percent-based width (e.g. Input, Slider) or implement the sap.ui.core.IShrinkable interface (e.g. Text, Label). This behavior can be overridden by providing sap.m.ToolbarLayoutData for the Toolbar items.
Note: It is recommended that you use sap.m.OverflowToolbar over Toolbar, unless you want to avoid overflow in favor of shrinking.
Since: 1.16.
Constructor Summary
new sap.m.Toolbar(sId?, mSettings?)Constructor for a new Toolbar. Event Summary
press(oControlEvent)Fired when the user clicks on the toolbar, if the Active property is set to "true". Method Summary
sap.m.Toolbar.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.Toolbar with name sClassName
and enriches it with the information contained in oClassInfo
. addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy
. addContent(oContent)Adds some content to the aggregation content
. attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the press
event of this sap.m.Toolbar
. detachPress(fnFunction, oListener)Detaches event handler fnFunction
from the press
event of this sap.m.Toolbar
. firePress(mArguments?)Fires event press
to attached listeners. getActive()Gets current value of property active
. getActiveDesign()Returns the currently applied design property of the Toolbar. getAriaLabelledBy()Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
. getDesign()Gets current value of property design
. getEnabled()Gets current value of property enabled
. getHeight()Gets current value of property height
. getTitleId()Returns the first sap.m.Title control id inside the toolbar for the accessibility getWidth()Gets current value of property width
. indexOfContent(oContent)Checks for the provided sap.ui.core.Control
in the aggregation content
. insertContent(oContent, iIndex)Inserts a content into the aggregation content
. removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy
. removeContent(vContent)Removes a content from the aggregation content
. setActive(bActive)Sets a new value for property active
. setDesign(sDesign)Sets a new value for property design
. setEnabled(bEnabled)Sets a new value for property enabled
. setHeight(sHeight)Sets a new value for property height
. setWidth(sWidth)Sets a new value for property width
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.m.Toolbar(sId?, mSettings?)
Constructor for a new Toolbar.
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
- width : sap.ui.core.CSSSize
- active : boolean (default: false)
- enabled : boolean (default: true)
- height : sap.ui.core.CSSSize (default: )
- design : sap.m.ToolbarDesign (default: Auto)
- Aggregations
- content : sap.ui.core.Control[] (default)
- Events
- press : 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 |
Field Detail
applyTagAndContextClassFor
Sets classes and tag according to the context in the page. Possible contexts are header, footer, subheader
getHTMLTag
Gets the HTML tag of the root domref
isContextSensitive
Returns if the bar is sensitive to the container context. Implementation of the IBar interface
setHTMLTag
Sets the HTML tag of the root domref
Event Detail
press(oControlEvent)
Fired when the user clicks on the toolbar, if the Active property is set to "true".
Parameters:
Method Detail
sap.m.Toolbar.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.Toolbar 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 |
Returns a metadata object for class sap.m.Toolbar.
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Adds some content to the aggregation content
.
Parameters:
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Attaches event handler
fnFunction
to the
press
event of this
sap.m.Toolbar
.
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.Toolbar
itself.
Fired when the user clicks on the toolbar, if the Active property is set to "true".
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.Toolbar itself |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Destroys all the content in the aggregation content
.
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Detaches event handler
fnFunction
from the
press
event of this
sap.m.Toolbar
.
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.Toolbar} | Reference to this in order to allow method chaining |
Fires event
press
to attached listeners.
Expects the following event parameters:
srcControl
of type sap.ui.core.Control
The toolbar item that was pressed
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
getActive(): boolean
Gets current value of property
active
.
Indicates that the whole toolbar is clickable. The Press event is fired only if Active is set to true. Note: This property should be used when there are no interactive controls inside the toolbar and the toolbar itself is meant to be interactive.
Default value is false
.
Returns:
{boolean} | Value of property active |
Returns the currently applied design property of the Toolbar.
Returns:
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
Returns:
Gets content of aggregation
content
.
The content of the toolbar.
Returns:
Gets current value of property
design
.
Defines the toolbar design. Note: Design settings are theme-dependent. They also determine the default height of the toolbar.
Default value is Auto
.
- Since:
- 1.16.8
Returns:
getEnabled(): boolean
Gets current value of property
enabled
.
Sets the enabled property of all controls defined in the content aggregation. Note: This property does not apply to the toolbar itself, but rather to its items.
Default value is true
.
Returns:
{boolean} | Value of property enabled |
Gets current value of property
height
.
Defines the height of the control. Note: By default, the Height property depends on the used theme and the Design property.
Default value is
.
Returns:
getTitleId(): String
Returns the first sap.m.Title control id inside the toolbar for the accessibility
- Since:
- 1.28
Returns:
Gets current value of property
width
.
Defines the width of the control. By default, Toolbar is a block element. If the the width is not explicitly set, the control will assume its natural size.
Returns:
indexOfContent(oContent): int
Checks for the provided sap.ui.core.Control
in the aggregation content
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a content into the aggregation content
.
Parameters:
{sap.ui.core.Control} | oContent | the content to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the content should be inserted at; for a negative value of iIndex , the content is inserted at position 0; for a value greater than the current size of the aggregation, the content is inserted at the last position |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Removes all the controls in the association named ariaLabelledBy
.
Returns:
Removes all the controls from the aggregation
content
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes an ariaLabelledBy from the association named ariaLabelledBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaLabelledBy | The ariaLabelledByto be removed or its index or ID |
Returns:
Removes a content from the aggregation content
.
Parameters:
Returns:
Sets a new value for property
active
.
Indicates that the whole toolbar is clickable. The Press event is fired only if Active is set to true. Note: This property should be used when there are no interactive controls inside the toolbar and the toolbar itself is meant to be interactive.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bActive | New value for property active |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Sets a new value for property
design
.
Defines the toolbar design. Note: Design settings are theme-dependent. They also determine the default height of the toolbar.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Auto
.
Parameters:
- Since:
- 1.16.8
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Sets a new value for property
enabled
.
Sets the enabled property of all controls defined in the content aggregation. Note: This property does not apply to the toolbar itself, but rather to its items.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bEnabled | New value for property enabled |
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Sets a new value for property
height
.
Defines the height of the control. Note: By default, the Height property depends on the used theme and the Design property.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is
.
Parameters:
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |
Sets a new value for property
width
.
Defines the width of the control. By default, Toolbar is a block element. If the the width is not explicitly set, the control will assume its natural size.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
{sap.m.Toolbar} | Reference to this in order to allow method chaining |