Class sap.m.ActionSheetModule: sap/m/ActionSheet

extends Control
known direct subclasses: LinkActionSheet

ActionSheet is a special kind of control which contains one or more sap.m.Button(s) and the ActionSheet will be closed when one of the buttons is tapped. It looks similar as a sap.m.Dialog in iPhone and Android while as a sap.m.Popover in iPad.


Since: 1.9.1.
Constructor Summary
new sap.m.ActionSheet(sId?, mSettings?)Constructor for a new ActionSheet.
Event Summary
afterClose(oControlEvent)This event will be fired after the ActionSheet is closed.
afterOpen(oControlEvent)This event will be fired after the ActionSheet is opened.
beforeClose(oControlEvent)This event will be fired before the ActionSheet is closed.
beforeOpen(oControlEvent)This event will be fired before the ActionSheet is opened.
cancelButtonPress(oControlEvent)This event is fired when the cancelButton is clicked.
cancelButtonTap(oControlEvent)This event is fired when the cancelButton is tapped.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.ActionSheet.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.ActionSheet with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.ActionSheet.getMetadata()Returns a metadata object for class sap.m.ActionSheet.
addButton(oButton)Adds some button to the aggregation buttons.
attachAfterClose(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the afterClose event of this sap.m.ActionSheet.
attachAfterOpen(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the afterOpen event of this sap.m.ActionSheet.
attachBeforeClose(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the beforeClose event of this sap.m.ActionSheet.
attachBeforeOpen(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the beforeOpen event of this sap.m.ActionSheet.
attachCancelButtonPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the cancelButtonPress event of this sap.m.ActionSheet.
close()Calling this method will make the ActionSheet disappear from the screen.
destroyButtons()Destroys all the buttons in the aggregation buttons.
detachAfterClose(fnFunction, oListener)Detaches event handler fnFunction from the afterClose event of this sap.m.ActionSheet.
detachAfterOpen(fnFunction, oListener)Detaches event handler fnFunction from the afterOpen event of this sap.m.ActionSheet.
detachBeforeClose(fnFunction, oListener)Detaches event handler fnFunction from the beforeClose event of this sap.m.ActionSheet.
detachBeforeOpen(fnFunction, oListener)Detaches event handler fnFunction from the beforeOpen event of this sap.m.ActionSheet.
detachCancelButtonPress(fnFunction, oListener)Detaches event handler fnFunction from the cancelButtonPress event of this sap.m.ActionSheet.
fireAfterClose(mArguments?)Fires event afterClose to attached listeners.
fireAfterOpen(mArguments?)Fires event afterOpen to attached listeners.
fireBeforeClose(mArguments?)Fires event beforeClose to attached listeners.
fireBeforeOpen(mArguments?)Fires event beforeOpen to attached listeners.
fireCancelButtonPress(mArguments?)Fires event cancelButtonPress to attached listeners.
getButtons()Gets content of aggregation buttons.
getCancelButtonText()Gets current value of property cancelButtonText.
getPlacement()Gets current value of property placement.
getShowCancelButton()Gets current value of property showCancelButton.
getTitle()Gets current value of property title.
indexOfButton(oButton)Checks for the provided sap.m.Button in the aggregation buttons.
insertButton(oButton, iIndex)Inserts a button into the aggregation buttons.
isOpen()The method checks if the ActionSheet is open.
openBy(oControl)Calling this method will make the ActionSheet visible on the screen.
removeAllButtons()Removes all the controls from the aggregation buttons.
removeButton(vButton)Removes a button from the aggregation buttons.
setCancelButtonText(sCancelButtonText)Sets a new value for property cancelButtonText.
setPlacement(sPlacement)Sets a new value for property placement.
setShowCancelButton(bShowCancelButton)Sets a new value for property showCancelButton.
setTitle(sTitle)Sets a new value for property title.
attachCancelButtonTap(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the cancelButtonTap event of this sap.m.ActionSheet.
detachCancelButtonTap(fnFunction, oListener)Detaches event handler fnFunction from the cancelButtonTap event of this sap.m.ActionSheet.
fireCancelButtonTap(mArguments?)Fires event cancelButtonTap to attached listeners.
Constructor Detail
new sap.m.ActionSheet(sId?, mSettings?)
Constructor for a new ActionSheet.

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
  • Events
    • cancelButtonTap : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • beforeOpen : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • afterOpen : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • beforeClose : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • afterClose : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • cancelButtonPress : 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
afterClose(oControlEvent)
This event will be fired after the ActionSheet is closed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
afterOpen(oControlEvent)
This event will be fired after the ActionSheet is opened.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
beforeClose(oControlEvent)
This event will be fired before the ActionSheet is closed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
beforeOpen(oControlEvent)
This event will be fired before the ActionSheet is opened.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
cancelButtonPress(oControlEvent)
This event is fired when the cancelButton is clicked. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by clicking outside.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
cancelButtonTap(oControlEvent)
This event is fired when the cancelButton is tapped. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by tapping outside.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Deprecated:
Since version 1.20.0. This event is deprecated, use the cancelButtonPress event instead.
Method Detail
sap.m.ActionSheet.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.ActionSheet 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.ActionSheet.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.ActionSheet.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addButton(oButton): sap.m.ActionSheet
Adds some button to the aggregation buttons.
Parameters:
{sap.m.Button}oButton the button to add; if empty, nothing is inserted
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
attachAfterClose(oData?, fnFunction, oListener?): sap.m.ActionSheet
Attaches event handler fnFunction to the afterClose event of this sap.m.ActionSheet.

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

This event will be fired after the ActionSheet 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.ActionSheet itself
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
attachAfterOpen(oData?, fnFunction, oListener?): sap.m.ActionSheet
Attaches event handler fnFunction to the afterOpen event of this sap.m.ActionSheet.

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

This event will be fired after the ActionSheet is opened.

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

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

This event will be fired before the ActionSheet 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.ActionSheet itself
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
attachBeforeOpen(oData?, fnFunction, oListener?): sap.m.ActionSheet
Attaches event handler fnFunction to the beforeOpen event of this sap.m.ActionSheet.

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

This event will be fired before the ActionSheet is opened.

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

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

This event is fired when the cancelButton is clicked. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by clicking outside.

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.ActionSheet itself
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
close(): void
Calling this method will make the ActionSheet disappear from the screen.
destroyButtons(): sap.m.ActionSheet
Destroys all the buttons in the aggregation buttons.
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
detachAfterClose(fnFunction, oListener): sap.m.ActionSheet
Detaches event handler fnFunction from the afterClose event of this sap.m.ActionSheet.

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

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

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

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

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.ActionSheet} Reference to this in order to allow method chaining
fireAfterClose(mArguments?): sap.m.ActionSheet
Fires event afterClose to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
fireAfterOpen(mArguments?): sap.m.ActionSheet
Fires event afterOpen to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
fireBeforeClose(mArguments?): sap.m.ActionSheet
Fires event beforeClose to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
fireBeforeOpen(mArguments?): sap.m.ActionSheet
Fires event beforeOpen to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
fireCancelButtonPress(mArguments?): sap.m.ActionSheet
Fires event cancelButtonPress to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
getButtons(): sap.m.Button[]
Gets content of aggregation buttons.

These buttons are added to the content area in ActionSheet control. When button is tapped, the ActionSheet is closed before the tap event listener is called.

Returns:
{sap.m.Button[]}
getCancelButtonText(): string
Gets current value of property cancelButtonText.

This is the text displayed in the cancelButton. Default value is "Cancel", and it's translated according to the current locale setting. This property will be ignored when running either in iPad or showCancelButton is set to false.

Returns:
{string} Value of property cancelButtonText
getPlacement(): sap.m.PlacementType
Gets current value of property placement.

The ActionSheet behaves as a sap.m.Popover in iPad and this property is the information about on which side will the popover be placed at. Possible values are sap.m.PlacementType.Left, sap.m.PlacementType.Right, sap.m.PlacementType.Top, sap.m.PlacementType.Bottom, sap.m.PlacementType.Horizontal, sap.m.PlacementType.HorizontalPreferedLeft, sap.m.PlacementType.HorizontalPreferedRight, sap.m.PlacementType.Vertical, sap.m.PlacementType.VerticalPreferedTop, sap.m.PlacementType.VerticalPreferedBottom. The default value is sap.m.PlacementType.Bottom.

Default value is Bottom.

Returns:
{sap.m.PlacementType} Value of property placement
getShowCancelButton(): boolean
Gets current value of property showCancelButton.

If this is set to true, there will be a cancel button shown below the action buttons. There won't be any cancel button shown in iPad regardless of this property. The default value is set to true.

Default value is true.

Returns:
{boolean} Value of property showCancelButton
getTitle(): string
Gets current value of property title.

Title will be shown in the header area in iPhone and every Android devices. This property will be ignored in tablets and desktop browser.

Returns:
{string} Value of property title
indexOfButton(oButton): int
Checks for the provided sap.m.Button in the aggregation buttons. and returns its index if found or -1 otherwise.
Parameters:
{sap.m.Button}oButton The button whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertButton(oButton, iIndex): sap.m.ActionSheet
Inserts a button into the aggregation buttons.
Parameters:
{sap.m.Button}oButton the button to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the button should be inserted at; for a negative value of iIndex, the button is inserted at position 0; for a value greater than the current size of the aggregation, the button is inserted at the last position
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
isOpen(): boolean
The method checks if the ActionSheet is open. It returns true when the ActionSheet is currently open (this includes opening and closing animations), otherwise it returns false.
Returns:
{boolean}
openBy(oControl): void
Calling this method will make the ActionSheet visible on the screen.
Parameters:
{object}oControl The ActionSheet behaves as a sap.m.Popover in iPad and the control parameter is the object to which the popover will be placed. It can be not only a UI5 control, but also an existing dom reference. The side of the placement depends on the placement property set in the popover. In other platforms, ActionSheet behaves as a standard dialog and this parameter is ignored because dialog is aligned to the screen.
removeAllButtons(): sap.m.Button[]
Removes all the controls from the aggregation buttons.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.m.Button[]} An array of the removed elements (might be empty)
removeButton(vButton): sap.m.Button
Removes a button from the aggregation buttons.
Parameters:
{int|string|sap.m.Button}vButton The buttonto remove or its index or id
Returns:
{sap.m.Button} The removed button or null
setCancelButtonText(sCancelButtonText): sap.m.ActionSheet
Sets a new value for property cancelButtonText.

This is the text displayed in the cancelButton. Default value is "Cancel", and it's translated according to the current locale setting. This property will be ignored when running either in iPad or showCancelButton is set to false.

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

Parameters:
{string}sCancelButtonText New value for property cancelButtonText
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
setPlacement(sPlacement): sap.m.ActionSheet
Sets a new value for property placement.

The ActionSheet behaves as a sap.m.Popover in iPad and this property is the information about on which side will the popover be placed at. Possible values are sap.m.PlacementType.Left, sap.m.PlacementType.Right, sap.m.PlacementType.Top, sap.m.PlacementType.Bottom, sap.m.PlacementType.Horizontal, sap.m.PlacementType.HorizontalPreferedLeft, sap.m.PlacementType.HorizontalPreferedRight, sap.m.PlacementType.Vertical, sap.m.PlacementType.VerticalPreferedTop, sap.m.PlacementType.VerticalPreferedBottom. The default value is sap.m.PlacementType.Bottom.

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

Default value is Bottom.

Parameters:
{sap.m.PlacementType}sPlacement New value for property placement
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
setShowCancelButton(bShowCancelButton): sap.m.ActionSheet
Sets a new value for property showCancelButton.

If this is set to true, there will be a cancel button shown below the action buttons. There won't be any cancel button shown in iPad regardless of this property. The default value is set to true.

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

Default value is true.

Parameters:
{boolean}bShowCancelButton New value for property showCancelButton
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
setTitle(sTitle): sap.m.ActionSheet
Sets a new value for property title.

Title will be shown in the header area in iPhone and every Android devices. This property will be ignored in tablets and desktop browser.

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

Parameters:
{string}sTitle New value for property title
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
attachCancelButtonTap(oData?, fnFunction, oListener?): sap.m.ActionSheet
Attaches event handler fnFunction to the cancelButtonTap event of this sap.m.ActionSheet.

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

This event is fired when the cancelButton is tapped. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by tapping outside.

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.ActionSheet itself
Deprecated:
Since version 1.20.0. This event is deprecated, use the cancelButtonPress event instead.
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
detachCancelButtonTap(fnFunction, oListener): sap.m.ActionSheet
Detaches event handler fnFunction from the cancelButtonTap event of this sap.m.ActionSheet.

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
Deprecated:
Since version 1.20.0. This event is deprecated, use the cancelButtonPress event instead.
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining
fireCancelButtonTap(mArguments?): sap.m.ActionSheet
Fires event cancelButtonTap to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Deprecated:
Since version 1.20.0. This event is deprecated, use the cancelButtonPress event instead.
Returns:
{sap.m.ActionSheet} Reference to this in order to allow method chaining