UI Widgets ActionSheet

A widget consisting of a set of choices related to a certain task.

Type: Object

The dxActionSheet widget is a sheet containing a set of buttons located one under the other. These buttons usually represent several choices relating to a single task.

To create the dxActionSheet widget, add a div element with dxActionSheet Knockout binding within the body of the required view.

HTML
<div data-bind="dxActionSheet: { dataSource: actionSheetData, visible: actionSheetVisible }"></div>

To control the widget visibility, assign an observable Boolean variable to the visible configuration option.

JavaScript
var actionSheetVisible = ko.observable(false);

The following code sample illustrates how to display the action sheet.

JavaScript
actionSheetVisible(true);

The action sheet items are configured using an array of objects specified via the dataSource option. Each object represents an action sheet button. The following is a sample dxActionSheet data source.

JavaScript
var actionSheetData = [
    {text:"Reply", clickAction: replyClicked},
    {text:"ReplyAll", clickAction: replyAllClicked},
    {text:"Forward", clickAction: forwardClicked},
    {text:"Delete", clickAction: deleteClicked}
];

To display action sheet items, a default template is applied based on the following fields of the data source item objects. These fields are used as configuration options for the dxButton widget created for each action sheet item.

  • text
    Specifies text displayed on the button.
  • type
    Specifies the type of the button.
  • clickAction
    An action performed when the button is clicked.
  • disabled
    A Boolean value specifying whether the button is disabled or enabled.

You can introduce a custom template for action sheet items. For this purpose, add a div element with the data-options attribute set to dxTemplate. Provide the item name to the template. In this instance, the template will be applied automatically. See the Customize Widget Item Appearance topic to learn more about item templates.

Refer to the Add a Widget documentation section to learn how to create widgets in detail.

Show Example:
jQuery
<div class="button" data-bind="dxButton:{text:'Show action sheet', clickAction: showActionSheet}"></div>
<div id="actionSheetContainer" data-bind="dxActionSheet: { dataSource: actionSheetData, visible: actionSheetVisible }"></div>
actionSheetVisible = ko.observable(false);
actionSheetData = [
    {text:"Reply", clickAction: function(){ processClick("Reply")}},
    {text:"ReplyAll", clickAction: function(){ processClick("ReplyAll")}},
    {text:"Forward", clickAction: function(){ processClick("Forward")}},
    {text:"Delete", clickAction: function(){ processClick("Delete")}}
];
processClick = function(name){
    DevExpress.ui.notify( name + " clicked", "success", 3000 );
};
showActionSheet = function () {
    actionSheetVisible(true);
};
body{
    text-align:center;
}
.button{
    margin-top:25px;
}

Configuration

An object defining configuration options for the dxActionSheet widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events fired by this component.