Class sap.ui.commons.ButtonModule: sap/ui/commons/Button
Enables users to trigger actions such as save or print. For the button UI, you can define some text or an icon, or both.
Deprecated API:Since version 1.38. Instead, use the sap.m.Button
control.
sClassName
and enriches it with the information contained in oClassInfo
.fnFunction
to the press
event of this sap.ui.commons.Button
.fnFunction
from the press
event of this sap.ui.commons.Button
.ariaDescribedBy
.ariaLabelledBy
.ariaDescribedBy
.ariaLabelledBy
. 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
- text : string (default: )
- enabled : boolean (default: true)
- width : sap.ui.core.CSSSize
- helpId : string (default: )
- icon : sap.ui.core.URI (default: )
- iconHovered : sap.ui.core.URI (default: )
- iconSelected : sap.ui.core.URI (default: )
- iconFirst : boolean (default: true)
- height : sap.ui.core.CSSSize
- styled : boolean (default: true)
- lite : boolean (default: false)
- style : sap.ui.commons.ButtonStyle (default: 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.
{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.Button
control.
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters |
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.
{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 |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
ariaDescribedBy
. {string|sap.ui.core.Control} | vAriaDescribedBy | the ariaDescribedBy to add; if empty, nothing is inserted |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
ariaLabelledBy
. {string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
fnFunction
to the press
event of this sap.ui.commons.Button
. 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.Button
itself.
Event is fired when the user presses the control.
{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.Button itself |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
fnFunction
from the press
event of this sap.ui.commons.Button
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
press
to attached listeners. {Map} | mArguments? | The arguments to pass along with the event |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
ariaDescribedBy
. {sap.ui.core.Control[]} |
ariaLabelledBy
. {sap.ui.core.Control[]} |
enabled
. Boolean property to enable the control (default is true). Buttons that are disabled have other colors than enabled ones, depending on custom settings.
Default value is true
.
{boolean} | Value of property enabled |
height
. Specifies the button height. If this property is set, the height which is specified by the underlying theme is not used any longer.
{sap.ui.core.CSSSize} | Value of property height |
helpId
. Unique identifier used for help service
Default value is .
{string} | Value of property helpId |
icon
. Icon to be displayed as graphical element within the button. This can be an URI to an image or an icon font URI.
Default value is .
{sap.ui.core.URI} | Value of property icon |
iconFirst
. If set to true (default), the display sequence is 1. icon 2. control text .
Default value is true
.
{boolean} | Value of property iconFirst |
iconHovered
. Icon to be displayed as graphical element within the button when it is hovered (only if also a base icon was specified). If not specified the base icon is used. If a icon font icon is used, this property is ignored.
Default value is .
{sap.ui.core.URI} | Value of property iconHovered |
iconSelected
. Icon to be displayed as graphical element within the button when it is selected (only if also a base icon was specified). If not specified the base or hovered icon is used. If a icon font icon is used, this property is ignored.
Default value is .
{sap.ui.core.URI} | Value of property iconSelected |
lite
. The button is rendered as lite button.
Default value is false
.
{boolean} | Value of property lite |
style
. Style of the button. (e.g. emphasized)
Default value is Default
.
{sap.ui.commons.ButtonStyle} | Value of property style |
styled
. Indicates if the button is styled. If not it is rendered as native HTML-button. In this case a custom styling can be added usig addStyleClass.
Default value is true
.
{boolean} | Value of property styled |
text
. Button text displayed at runtime.
Default value is .
{string} | Value of property text |
width
. Control width as common CSS-size (px or % as unit, for example)
{sap.ui.core.CSSSize} | Value of property width |
ariaDescribedBy
. {sap.ui.core.Control[]} | An array of the removed elements (might be empty) |
ariaLabelledBy
. {sap.ui.core.Control[]} | An array of the removed elements (might be empty) |
ariaDescribedBy
. {int|string|sap.ui.core.Control} | vAriaDescribedBy | The ariaDescribedByto be removed or its index or ID |
{sap.ui.core.Control} | the removed ariaDescribedBy or null |
ariaLabelledBy
. {int|string|sap.ui.core.Control} | vAriaLabelledBy | The ariaLabelledByto be removed or its index or ID |
{sap.ui.core.Control} | the removed ariaLabelledBy or null |
enabled
. Boolean property to enable the control (default is true). Buttons that are disabled have other colors than enabled ones, depending on custom settings.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bEnabled | New value for property enabled |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
height
. Specifies the button height. If this property is set, the height which is specified by the underlying theme is not used any longer.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.CSSSize} | sHeight | New value for property height |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
helpId
. Unique identifier used for help service
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{string} | sHelpId | New value for property helpId |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
icon
. Icon to be displayed as graphical element within the button. This can be an URI to an image or an icon font URI.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{sap.ui.core.URI} | sIcon | New value for property icon |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
iconFirst
. If set to true (default), the display sequence is 1. icon 2. control text .
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bIconFirst | New value for property iconFirst |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
iconHovered
. Icon to be displayed as graphical element within the button when it is hovered (only if also a base icon was specified). If not specified the base icon is used. If a icon font icon is used, this property is ignored.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{sap.ui.core.URI} | sIconHovered | New value for property iconHovered |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
iconSelected
. Icon to be displayed as graphical element within the button when it is selected (only if also a base icon was specified). If not specified the base or hovered icon is used. If a icon font icon is used, this property is ignored.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{sap.ui.core.URI} | sIconSelected | New value for property iconSelected |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
lite
. The button is rendered as lite button.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bLite | New value for property lite |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
style
. Style of the button. (e.g. emphasized)
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Default
.
{sap.ui.commons.ButtonStyle} | sStyle | New value for property style |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
styled
. Indicates if the button is styled. If not it is rendered as native HTML-button. In this case a custom styling can be added usig addStyleClass.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
{boolean} | bStyled | New value for property styled |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
text
. Button text displayed at runtime.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{string} | sText | New value for property text |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |
width
. Control width as common CSS-size (px or % as unit, for example)
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.CSSSize} | sWidth | New value for property width |
{sap.ui.commons.Button} | Reference to this in order to allow method chaining |