The action sheet holds a list of options from which the user can select to complete an action.
The options of the action sheet are represented as buttons with icons. Elements in the action sheet are left-aligned. Actions should be arranged in order of importance, from top to bottom.
On mobile phones the action sheet is displayed in a dialog.
On tablets and desktop the action sheet is displayed in a popover.
When an action is triggered, the action sheet closes and you can display a confirmation as a message toast.
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#constructor for a general description of the syntax of the settings object.
new sap.m.ActionSheet(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
cancelButtonText | string | 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. Visibility: public |
|
placement | sap.m.PlacementType | Bottom | The ActionSheet behaves as an 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. Visibility: public |
showCancelButton | boolean | true | 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. Visibility: public |
title | string | Title will be shown in the header area in iPhone and every Android devices. This property will be ignored in tablets and desktop browser. Visibility: public |
Default Aggregation: buttons
Name | Cardinality | Type | Description |
---|---|---|---|
_cancelButton | 0..1 | sap.m.Button |
The internally managed cancel button. |
_invisibleAriaTexts | 0..n | sap.ui.core.InvisibleText |
Hidden texts used for accesibility |
buttons (default) | 0..n | sap.m.Button |
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. |
Event | Description |
---|---|
afterClose |
This event will be fired after the ActionSheet is closed. |
afterOpen |
This event will be fired after the ActionSheet is opened. |
beforeClose |
This event will be fired before the ActionSheet is closed. |
beforeOpen |
This event will be fired before the ActionSheet is opened. |
cancelButtonPress |
This event is fired when the cancelButton is clicked. Note: For any device other than phones, this event would be fired always when the Popover closes. To prevent this behavior, the |
cancelButtonTap |
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. |
This event will be fired after the ActionSheet is closed.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
origin | sap.m.Button |
This indicates the trigger of closing the control. If dialog is closed by either selection or closeButton (on mobile device), the button that closes the dialog is set to this parameter. Otherwise this parameter is set to null. |
This event will be fired after the ActionSheet is opened.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object |
This event will be fired before the ActionSheet is closed.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
origin | sap.m.Button |
This indicates the trigger of closing the dialog. If dialog is closed by either leftButton or rightButton, the button that closes the dialog is set to this parameter. Otherwise this parameter is set to null. This is valid only for Phone mode of the ActionSheet |
This event will be fired before the ActionSheet is opened.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object |
This event is fired when the cancelButton is clicked.
Note: For any device other than phones, this event would be fired always when the Popover closes. To prevent this behavior, the showCancelButton
property needs to be set to false
.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object |
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.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object |
Method | Description |
---|---|
addButton |
Adds some button to the aggregation buttons. |
attachAfterClose |
Attaches event handler When called, the context of the event handler (its This event will be fired after the ActionSheet is closed. |
attachAfterOpen |
Attaches event handler When called, the context of the event handler (its This event will be fired after the ActionSheet is opened. |
attachBeforeClose |
Attaches event handler When called, the context of the event handler (its This event will be fired before the ActionSheet is closed. |
attachBeforeOpen |
Attaches event handler When called, the context of the event handler (its This event will be fired before the ActionSheet is opened. |
attachCancelButtonPress |
Attaches event handler When called, the context of the event handler (its This event is fired when the cancelButton is clicked. Note: For any device other than phones, this event would be fired always when the Popover closes. To prevent this behavior, the |
attachCancelButtonTap |
Attaches event handler When called, the context of the event handler (its 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.
Since 1.20.0 This event is deprecated, use the cancelButtonPress event instead.
|
close |
Calling this method will make the ActionSheet disappear from the screen. |
destroyButtons |
Destroys all the buttons in the aggregation buttons. |
detachAfterClose |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachAfterOpen |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachBeforeClose |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachBeforeOpen |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachCancelButtonPress |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachCancelButtonTap |
Detaches event handler The passed function and listener object must match the ones used for event registration.
Since 1.20.0 This event is deprecated, use the cancelButtonPress event instead.
|
sap.m.ActionSheet.extend |
Creates a new subclass of class sap.m.ActionSheet with name
|
fireAfterClose |
Fires event afterClose to attached listeners. |
fireAfterOpen |
Fires event afterOpen to attached listeners. |
fireBeforeClose |
Fires event beforeClose to attached listeners. |
fireBeforeOpen |
Fires event beforeOpen to attached listeners. |
fireCancelButtonPress |
Fires event cancelButtonPress to attached listeners. |
fireCancelButtonTap |
Fires event cancelButtonTap to attached listeners.
Since 1.20.0 This event is deprecated, use the cancelButtonPress event instead.
|
getButtons |
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. |
getCancelButtonText |
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. |
sap.m.ActionSheet.getMetadata |
Returns a metadata object for class sap.m.ActionSheet. |
getPlacement |
Gets current value of property placement. The ActionSheet behaves as an 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 |
getPopupHiddenLabelId |
Gets the ID of the hidden label |
getShowCancelButton |
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 |
getTitle |
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. |
indexOfButton |
Checks for the provided |
insertButton |
Inserts a button into the aggregation buttons. |
isOpen |
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. |
openBy |
Calling this method will make the ActionSheet visible on the screen. The control parameter is the object to which the ActionSheet 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 |
removeAllButtons |
Removes all the controls from the aggregation buttons. Additionally, it unregisters them from the hosting UIArea. |
removeButton |
Removes a button from the aggregation buttons. |
setCancelButtonText |
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 |
setPlacement |
Sets a new value for property placement. The ActionSheet behaves as an 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 Default value is |
setShowCancelButton |
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 Default value is |
setTitle |
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 |
Adds some button to the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.m.Button |
The button to add; if empty, nothing is inserted |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Note: For any device other than phones, this event would be fired always when the Popover closes. To prevent this behavior, the showCancelButton
property needs to be set to false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event afterClose to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
origin | sap.m.Button |
This indicates the trigger of closing the control. If dialog is closed by either selection or closeButton (on mobile device), the button that closes the dialog is set to this parameter. Otherwise this parameter is set to null. |
Fires event afterOpen to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Fires event beforeClose to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
origin | sap.m.Button |
This indicates the trigger of closing the dialog. If dialog is closed by either leftButton or rightButton, the button that closes the dialog is set to this parameter. Otherwise this parameter is set to null. This is valid only for Phone mode of the ActionSheet |
Fires event beforeOpen to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Fires event cancelButtonPress to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Fires event cancelButtonTap to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
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.
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.
Gets current value of property placement.
The ActionSheet behaves as an 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
.
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
.
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.
Checks for the provided sap.m.Button
in the aggregation buttons. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.m.Button |
The button whose index is looked for |
Inserts a button into the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.m.Button |
The button to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
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.
Calling this method will make the ActionSheet visible on the screen. The control parameter is the object to which the ActionSheet 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 (on tablet and desktop). On other platforms, ActionSheet behaves as a standard dialog and this parameter is ignored because dialog is aligned to the screen.
Param | Type | DefaultValue | Description |
---|---|---|---|
oControl | object |
The control to which the ActionSheet is opened |
Removes all the controls from the aggregation buttons.
Additionally, it unregisters them from the hosting UIArea.
Removes a button from the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
vButton | int string sap.m.Button |
The button to remove or its index or id |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sCancelButtonText | string |
New value for property |
Sets a new value for property placement.
The ActionSheet behaves as an 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPlacement | sap.m.PlacementType | Bottom |
New value for property |
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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowCancelButton | boolean | true |
New value for property |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTitle | string |
New value for property |