Class sap.m.SegmentedButtonItemModule: sap/m/SegmentedButtonItem

extends Item

The SegmentedButtonItem control is used for creating buttons for the sap.m.SegmentedButton. It is derived from a core sap.ui.core.Item.


Since: 1.28.
Constructor Summary
new sap.m.SegmentedButtonItem(sId?, mSettings?)Constructor for a new SegmentedButtonItem.
Event Summary
press(oControlEvent)Fires when the user clicks on an individual button.
Method Summary
sap.m.SegmentedButtonItem.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.SegmentedButtonItem with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.SegmentedButtonItem.getMetadata()Returns a metadata object for class sap.m.SegmentedButtonItem.
attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the press event of this sap.m.SegmentedButtonItem.
detachPress(fnFunction, oListener)Detaches event handler fnFunction from the press event of this sap.m.SegmentedButtonItem.
firePress(mArguments?)Fires event press to attached listeners.
getIcon()Gets current value of property icon.
getVisible()Gets current value of property visible.
getWidth()Gets current value of property width.
setIcon(sIcon)Sets a new value for property icon.
setVisible(bVisible)Sets a new value for property visible.
setWidth(sWidth)Sets a new value for property width.
Constructor Detail
new sap.m.SegmentedButtonItem(sId?, mSettings?)
Constructor for a new SegmentedButtonItem.

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
  • Events
    • press : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.core.Item 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
press(oControlEvent)
Fires when the user clicks on an individual button.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Method Detail
sap.m.SegmentedButtonItem.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.SegmentedButtonItem 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.Item.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.SegmentedButtonItem.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.SegmentedButtonItem.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachPress(oData?, fnFunction, oListener?): sap.m.SegmentedButtonItem
Attaches event handler fnFunction to the press event of this sap.m.SegmentedButtonItem.

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.SegmentedButtonItem itself.

Fires when the user clicks on an individual button.

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.SegmentedButtonItem itself
Returns:
{sap.m.SegmentedButtonItem} Reference to this in order to allow method chaining
detachPress(fnFunction, oListener): sap.m.SegmentedButtonItem
Detaches event handler fnFunction from the press event of this sap.m.SegmentedButtonItem.

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.SegmentedButtonItem} Reference to this in order to allow method chaining
firePress(mArguments?): sap.m.SegmentedButtonItem
Fires event press to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.SegmentedButtonItem} Reference to this in order to allow method chaining
getIcon(): string
Gets current value of property icon.

The icon, which belongs to the button. This can be an URI to an image or an icon font URI.

Returns:
{string} Value of property icon
getVisible(): boolean
Gets current value of property visible.

Whether the button should be visible on the screen. If set to false, a placeholder is rendered instead of the real button.

Default value is true.

Returns:
{boolean} Value of property visible
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

Sets the width of the buttons.

Returns:
{sap.ui.core.CSSSize} Value of property width
setIcon(sIcon): sap.m.SegmentedButtonItem
Sets a new value for property icon.

The icon, which belongs to 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.

Parameters:
{string}sIcon New value for property icon
Returns:
{sap.m.SegmentedButtonItem} Reference to this in order to allow method chaining
setVisible(bVisible): sap.m.SegmentedButtonItem
Sets a new value for property visible.

Whether the button should be visible on the screen. If set to false, a placeholder is rendered instead of the real button.

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

Default value is true.

Parameters:
{boolean}bVisible New value for property visible
Returns:
{sap.m.SegmentedButtonItem} Reference to this in order to allow method chaining
setWidth(sWidth): sap.m.SegmentedButtonItem
Sets a new value for property width.

Sets the width of the buttons.

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.m.SegmentedButtonItem} Reference to this in order to allow method chaining