UI Widgets SlideOut

The widget that allows you to slide-out the current view to reveal an item list.

Included in: dx.mobile.js, dx.all.js
Module: ui/slide_out

In its simplest form, this widget consists of a panel that slides out to reveal a menu with an item list.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxSlideOut jQuery plug-in.

    HTML
    <div id="slideOut"></div>
    JavaScript
    $("#slideOut").dxSlideOut({
        dataSource: slideOutData
    });
  • Knockout
    Add a div element and apply the dxSlideOut binding to this element.

    HTML
    <div data-bind="dxSlideOut: {
        dataSource: slideOutData
    }"></div>
  • AngularJS
    Add a div element and apply the dx-slide-out directive to this element.

    HTML
    <div dx-slide-out="{
        dataSource: slideOutData
    }"></div>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

Since the SlideOut widget is used to display multiple items, it supports common Collection Container widget functionality. You can find detailed information on the principles of working with the widget in the dxSlideOut section of the Collection Container Widgets article.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div dx-slide-out="{
        dataSource: slideOutData,
        onItemClick: changeMenuVisibility,
        bindingOptions: {
            selectedIndex: 'currentIndex',
            menuVisible: 'showMenu'
        }
    }" dx-item-alias="itemObj">
        <div data-options="dxTemplate : { name: 'item' } ">
            <div dx-button="{
                text: 'Show Menu',
                onClick: $parent.changeMenuVisibility
            }"></div>
            <p>Currently selected menu item is: <b>{{itemObj.text}}</b>.</p>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.currentIndex = 0;
    $scope.showMenu = false;
    $scope.slideOutData = [
        { text: 'Item 1' },
        { text: 'Item 2' },
        { text: 'Item 3' }
    ];
    $scope.changeMenuVisibility = function () {
        $scope.showMenu = !$scope.showMenu;
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
<div data-bind="dxSlideOut:{
    dataSource: slideOutData,
    selectedIndex: currentIndex,
    menuVisible: showMenu,
    onItemClick: changeMenuVisibility
}">
    <div data-options="dxTemplate : { name: 'item' } ">
        <div data-bind="dxButton: {
            text: 'Show Menu',
            onClick: $root.changeMenuVisibility
        }"></div>
        <p>Currently selected menu item is: <b data-bind="text: text"></b>.</p>
    </div>
</div>
var myViewModel = {
    currentIndex: ko.observable(0),
    showMenu: ko.observable(false),
    slideOutData: [
        { text: 'Item 1' },
        { text: 'Item 2' },
        { text: 'Item 3' }
    ],
    changeMenuVisibility: function () {
        myViewModel.showMenu(!myViewModel.showMenu());
    }
}
ko.applyBindings(myViewModel);
<div id="mySlideOut"></div>
$("#mySlideOut").dxSlideOut({
    items: [
        { text: 'Item 1' },
        { text: 'Item 2' },
        { text: 'Item 3' }
    ],
    selectedIndex: 0,
    onItemClick: function(){
        $("#mySlideOut").dxSlideOut("instance").hideMenu();
    },
    itemTemplate: function (itemData, itemIndex, itemElement) {
        var button = $("<div>").dxButton({
            text: 'Show Menu',
            onClick: function () {
                $("#mySlideOut").dxSlideOut("instance").showMenu();
            }
        });
        itemElement.append(button)
        itemElement.append("<p>Currently selected menu item is: <b>" + itemData.text + "</b>.</p>")
    }
});

Configuration

An object defining configuration options for the SlideOut widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

Default Item Template

This section lists the data source fields that are used in a default template for SlideOut items.

By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is the list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.

See Also