ContextMenu Configuration

An object defining configuration options for the dxContextMenu widget.

accessKey

Specifies a shortcut key that sets focus on the widget element.

Type: String
Default Value: null

The accessKey option value is passed to the accesskey attribute of the actual HTML element of the widget.

activeStateEnabled

A Boolean value specifying whether or not the widget changes its state when interacting with a user.

Type: Boolean
Default Value: true

This option is used when the widget is displayed on a platform whose guidelines include the active state change for widgets.

alternativeInvocationMode

Holds an object that specifies options of alternative menu invocation.

Type: Object
Default Value: { enabled: false, invokingElement: null }

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="ui-element" dx-check-box="{
        text: 'Show context menu',
        bindingOptions: {
            value: 'alternateInvocation'
        }
    }"></div><br />
    <div id="invokeButton" dx-button="{
        text: 'Show context menu',
        bindingOptions: {
            visible: 'alternateInvocation'
        }
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        alternativeInvocationMode: {
            invokingElement: '#invokeButton'
        },
        bindingOptions: {
            'alternativeInvocationMode.enabled': 'alternateInvocation',
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.alternateInvocation = false;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

#invokeButton{
    margin-bottom: 15px;
}
<div class="demo-page">
    <div class="ui-element" data-bind="dxCheckBox: { value: alternateInvocation, text: 'invokeOnlyFromCode' }"></div><br />
    <div id="invokeButton" data-bind="dxButton: {
        text: 'Show context menu',
        visible: alternateInvocation
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        alternativeInvocationMode: {
            enabled: alternateInvocation,
            invokingElement: '#invokeButton'
        }
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    alternateInvocation: ko.observable(false)
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

#invokeButton{
    margin-bottom: 15px;
}
<div class="demo-page">
    <div class="ui-element" id="invocationSelector"></div><br />
    <div id="invokeButton"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    alternativeInvocationMode: {
        enabled: false,
        invokingElement: "#invokeButton"
    }
});
$("#invokeButton").dxButton({
    text: "Show context menu",
    visible: false
});
$("#invocationSelector").dxCheckBox({
    value: false,
    text: "alternateInvocation.enabled",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("alternativeInvocationMode.enabled", e.value);
        $("#invokeButton").dxButton("instance").option("visible", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

#invokeButton{
    margin-bottom: 15px;
}

animation

An object that defines the animation options of the widget.

Default Value: { show: { type: "fade", from: 0, to: 1, duration: 100 }, hide: { type: "fade", from: 1, to: 0, duration: 100 } }

contentReadyAction

Deprecated

Use the onContentReady option instead.

Show Example:
jQuery
<div style="background-color: #F0F0F0; height: 400px; max-width: 400px; margin: 0 auto; padding-top: 10px">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: { dataSource: menuItems, target: '#contextMenuTarget', onContentReady: contentReady }"></div>
</div>
menuItems = [
    { text: 'Increase' },
    { 
        text: 'Share', 
        items: [
            { text: 'Send to a friend' },
            { text: 'Send to a group' }]
    },
    { text: 'Download' },
    { text: 'Comment' },
    { text: 'Favorite' }
];

contentReady = function(data) {
    DevExpress.ui.notify("Content is ready", "success", 1500);
}
body{
  text-align: center;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-left: 10px
}

cssClass

Specifies the name of the CSS class associated with the menu.

Type: String
Default Value: ""

Use this option to customize the current menu in isolation from other menus created on the same page.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target1" id="contextMenuTarget1"></div>
    <div class="target2" id="contextMenuTarget2"></div>
    <div dx-context-menu="{ dataSource: menuItems, target: '#contextMenuTarget1' }"></div>
    <div dx-context-menu="{ dataSource: menuItems, target: '#contextMenuTarget2', cssClass: 'customClass' }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

.target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}

.dx-context-menu .dx-menu-item
{
    border-bottom: 1px solid rgba(0,0,0,.2);
}
.customClass .dx-menu-item 
{
    border-bottom: none;
}
<div class="demo-page">
    <div class="target1" id="contextMenuTarget1"></div>
    <div class="target2" id="contextMenuTarget2"></div>
    <div data-bind="dxContextMenu: { dataSource: menuItems, target: '#contextMenuTarget1' }"></div>
    <div data-bind="dxContextMenu: { dataSource: menuItems, target: '#contextMenuTarget2', cssClass: 'customClass' }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

.target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}

.dx-context-menu .dx-menu-item
{
    border-bottom: 1px solid rgba(0,0,0,.2);
}
.customClass .dx-menu-item 
{
    border-bottom: none;
}
<div class="demo-page">
    <div class="target1" id="contextMenuTarget1"></div>
    <div class="target2" id="contextMenuTarget2"></div>
    <div id="contextMenu1"></div>
    <div id="contextMenu2"></div>
</div>
var menuItems = [
    { text: 'Increase' },
    {
        text: 'Share',
        items: [
            { text: 'Send to a friend' },
            { text: 'Send to a group' }]
    },
    { text: 'Download' },
    { text: 'Comment' },
    { text: 'Favorite' }
];
$("#contextMenu1").dxContextMenu({
    dataSource: menuItems,
    target: '#contextMenuTarget1'
});
$("#contextMenu2").dxContextMenu({
    dataSource: menuItems,
    target: '#contextMenuTarget2',
    cssClass: 'customClass'
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

.target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}

.dx-context-menu .dx-menu-item
{
    border-bottom: 1px solid rgba(0,0,0,.2);
}
.customClass .dx-menu-item 
{
    border-bottom: none;
}

dataSource

A data source used to fetch data to be displayed by the widget.

Default Value: null

You can assign an array directly to this option as well as use the Data Source provided by the DevExtreme library.

To display widget items, a default template can be used. This template is based on the data source fields that are listed in the Default Item Template section of the widget's API. Alternatively, you can implement a custom item template.

See Also

disabled

A Boolean value specifying whether or not the widget can respond to user interaction.

Type: Boolean
Default Value: false

Create an observable variable and assign it to this option to specify the availability of the widget at runtime.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="ui-element" dx-check-box="{
        text: 'disabled',
        bindingOptions: {
            value: 'menuDisabled'
        }
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        bindingOptions: {
            disabled: 'menuDisabled'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuDisabled = false;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" data-bind="dxCheckBox: { value: menuDisabled, text: 'disabled' }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        disabled: menuDisabled
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuDisabled: ko.observable(false)
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" id="disabledSelector"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget'
});
$("#disabledSelector").dxCheckBox({
    value: false,
    text: "disabled",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("disabled", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

focusStateEnabled

Specifies whether or not the widget can be focused.

Type: Boolean
Default Value: false

height

Specifies the height of the widget.

Type: Number|String|function
Return Value: Number|String
The widget height.
Default Value: undefined

The option can hold a value of the following types.

  • number
    The height of the widget in pixels

  • string
    A CSS measurement of the widget height (e.g., "55px", "80%", "auto" and "inherit")

  • function
    A function returning the widget height (e.g., height:function(){ return baseHeight - 10 + "%"; })

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        height: 200
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        height: 200
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    height: 200
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

hint

Specifies the text of the hint displayed for the widget.

Type: String
Default Value: undefined

hoverStateEnabled

A Boolean value specifying whether or not the widget changes its state when being hovered by an end user.

Type: Boolean
Default Value: true

itemClickAction

Deprecated

Use the onItemClick option instead.

itemRender

Deprecated

Use the itemTemplate option instead.

itemRenderedAction

Deprecated

Use the onItemRendered option instead.

items

Holds an array of menu items.

Type: Array

To display menu items, a default template can be used. This template is based on certain fields of the item object. Refer to the Default Item Template section to learn which fields are taken into account when creating a default template for items. Alternatively, you can implement a custom item template.

See Also

NOTE: Each item of the array passed to the items option can include the items field, which takes on an object with the same structure as a root item. Therefore, you can create as many menu levels as you need.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        items: menuItems,
        target: '#contextMenuTarget'
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        items: menuItems,
        target: '#contextMenuTarget'
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    items: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget'
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

itemSelectAction

Deprecated

Use the onSelectionChanged option instead.

A function performed when a widget item is selected.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
itemData: Object
The data that is bound to the selected item.
itemElement: jQuery
An HTML element representing the item.
itemIndex: Number
Specifies the index of the just selected item.
Default Value: null

Assign a function to perform a custom action when a widget item is selected.

Alternatively, you can assign a URL to which the browser will navigate when a widget item is selected.

itemTemplate

The template to be used for rendering items.

Type: String|function|DOM Node|jQuery
Function parameters:
itemData: Object
The item object to be rendered.
itemIndex: Number
The index of the item to be rendered.
itemElement: jQuery
An HTML element of the item to be rendered.
Return Value: String|DOM Node|jQuery
A template name or a template container.
Default Value: "item"
See Also

NOTE: A binding context of an item template is the data source object that corresponds to the currently rendered item. So, you can bind template elements to the item object's fields directly (see the code above). To access another binding context within an item template, use Knockout/Angular binding variables.

onContentReady

A handler for the contentReady event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action when widget content is ready.

onDisposing

A handler for the disposing event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

onHidden

A handler for the hidden event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        items: menuItems,
        target: '#contextMenuTarget',
        onHidden: menuHidden
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuHidden = function () {
        DevExpress.ui.notify("Context menu is hidden", "success", 1500);
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        items: menuItems,
        target: '#contextMenuTarget',
        onHidden: menuHidden
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuHidden: function () {
        DevExpress.ui.notify("Context menu is hidden", "success", 1500);
    }
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    items: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onHidden: function () {
        DevExpress.ui.notify("Context menu is hidden", "success", 1500);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

onHiding

A handler for the hiding event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
cancel: Boolean
Specifies whether or not to cancel the hiding of the widget.
Default Value: null

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu" dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        onHiding: menuHiding
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
var canHideMenu = false;
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }
            ]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuHiding = function (e) {
        if (canHideMenu) {
            canHideMenu = false;
            return;
        }
        var result = DevExpress.ui.dialog.confirm("Context menu is hiding now. Continue?", "Confirm hiding");
        e.cancel = true;
        result.done(function (dialogResult) {
            if (!dialogResult)
                return;
            canHideMenu = true;
            $("#myContextMenu").dxContextMenu("instance").hide();
        })
    };
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu" data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        onHiding: menuHiding
    }"></div>
</div>
var canHideMenu = false;
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuHiding: function (e) {
        if (canHideMenu) {
            canHideMenu = false;
            return;
        }
        var result = DevExpress.ui.dialog.confirm("Context menu is hiding now. Continue?", "Confirm hiding");
        e.cancel = true;
        result.done(function (dialogResult) {
            if (!dialogResult)
                return;
            canHideMenu = true;
            $("#myContextMenu").dxContextMenu("instance").hide();
        })
    }
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
var canHideMenu = false;
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onHiding: function (e) {
        if (canHideMenu) {
            canHideMenu = false;
            return;
        }
        var result = DevExpress.ui.dialog.confirm("Context menu is hiding now. Continue?", "Confirm hiding");
        e.cancel = true;
        result.done(function (dialogResult) {
            if (!dialogResult)
                return;
            canHideMenu = true;
            $("#myContextMenu").dxContextMenu("instance").hide();
        })
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

onInitialized

A handler for the initialized event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
Default Value: null

Assign a function to perform a custom action when the widget is initialized.

onItemClick

A handler for the itemClick event.

Type: function|String
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
itemData: Object
The data that is bound to the clicked item.
itemElement: jQuery
An HTML element of the item.
itemIndex: Number
Specifies the index of the clicked item.
jQueryEvent: jQuery.Event
Specifies the jQuery event that caused action execution.
Default Value: null

Assign a function to perform a custom action when a widget item is clicked.

To navigate to a specific URL when the itemClick event fires, assign that URL or the anchor part (#) of that URL directly to this option as a string.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        items: menuItems,
        target: '#contextMenuTarget',
        onItemClick: itemClicked
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.itemClicked = function (e) {
        DevExpress.ui.notify("The \"" + e.itemData.text + "\" item is clicked", "success", 1500);
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        items: menuItems,
        target: '#contextMenuTarget',
        onItemClick: itemClicked
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    itemClicked: function (e) {
        DevExpress.ui.notify("The \"" + e.itemData.text + "\" item is clicked", "success", 1500);
    }
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    items: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onItemClick: function (e) {
        DevExpress.ui.notify("The \"" + e.itemData.text + "\" item is clicked", "success", 1500);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

onItemContextMenu

A handler for the itemContextMenu event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
itemData: Object
The data that is bound to the item.
itemElement: jQuery
An HTML element of the item.
itemIndex: Number
Specifies the index of the item.
jQueryEvent: jQuery.Event
Specifies the jQuery event that caused action execution.
Default Value: null

Assign a function to perform a custom action when the right mouse button is clicked when the pointer is over a widget item, or when the "sustained" (also known as a long press) touch action is performed.

onItemRendered

A handler for the itemRendered event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data available for binding against the element. Available only in the Knockout and AngularJS approaches.
itemData: Object
The data that is bound to the item to be rendered.
itemElement: jQuery
An HTML element of the item.
itemIndex: Number
Specifies the index of the rendered item.
Default Value: null

Assign a function to perform a custom action after a collection item is rendered.

onOptionChanged

A handler for the optionChanged event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
name: String
Specifies the name of the option whose value is changed.
fullName: String
Specifies a full name of the option whose value is changed. The full name is formed by concatenating the names of the options that are presented in the hierarchy of the given option. The names are delimited by commas.
value: any
Specifies a new value for the option.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Assign a function to perform a custom action after an option of the component is changed.

onPositioning

A handler for the positioning event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
jQueryEvent: jQuery.Event
Returns a jQuery event that caused the event.
position: position
An object that holds context menu positioning options.
Default Value: null

onSelectionChanged

A handler for the selectionChanged event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
addedItems: Array
An array of items added to selection.
removedItems: Array
An array of items removed from selection.
Default Value: null

Assign a function to perform a custom action after a collection item is selected or unselected.

onShowing

A handler for the showing event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        items: menuItems,
        target: '#contextMenuTarget',
        onShowing: menuShowing
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuShowing = function () {
        DevExpress.ui.notify("Context menu is showing now", "success", 1500);
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        items: menuItems,
        target: '#contextMenuTarget',
        onShowing: menuShowing
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuShowing: function () {
        DevExpress.ui.notify("Context menu is showing now", "success", 1500);
    }
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    items: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onShowing: function () {
        DevExpress.ui.notify("Context menu is showing now", "success", 1500);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

onShown

A handler for the shown event.

Type: function
Function parameters:
e: Object
Provides function parameters.
Object structure:
component: Object
Provides access to the widget instance.
element: jQuery
An HTML element of the widget.
model: Object
Provides access to the data that is available for binding against the element. Available only in the Knockout and AngularJS approaches.
Default Value: null

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        items: menuItems,
        target: '#contextMenuTarget',
        onShown: menuShown
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuShown = function () {
        DevExpress.ui.notify("Context menu is shown", "success", 1500);
    }
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        items: menuItems,
        target: '#contextMenuTarget',
        onShown: menuShown
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuShown: function () {
        DevExpress.ui.notify("Context menu is shown", "success", 1500);
    }
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    items: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onShown: function () {
        DevExpress.ui.notify("Context menu is shown", "success", 1500);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

position

An object defining widget positioning options.

Type: Object
Default Value: { my: "top left", at: "top left" }

NOTE: To specify the element against which the context menu will be positioned, use the target option instead of the of field of the position object. If both target and of are specified, target will be used.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="dx-fieldset" style="width: 250px;">
        <div class="dx-fieldset-header">Position</div>
        <div class="dx-field">
            <div class="dx-field-label">my</div>
            <div class="dx-field-value" dx-select-box="{
                dataSource: positionValues,
                bindingOptions: {
                    value: 'myValue'
                }
            }"></div>
        </div>
        <div class="dx-field">
            <div class="dx-field-label">at</div>
            <div class="dx-field-value" dx-select-box="{
                dataSource: positionValues,
                bindingOptions: {
                    value: 'atValue'
                }
            }"></div>
        </div>
    </div>
    <div class="ui-element" dx-button="{
        text: 'Show context menu',
        onClick: showMenu
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        invokeOnlyFromCode: true,
        bindingOptions: {
            visible: 'menuVisible',
            'position.my': 'myValue',
            'position.at': 'atValue'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuVisible = false;
    $scope.showMenu = function () {
        $scope.menuVisible = true;
    };
    $scope.myValue = "left top";
    $scope.atValue = "center";
    $scope.positionValues = [
        "left top",
        "top",
        "right top",
        "right",
        "right bottom",
        "bottom",
        "left bottom",
        "left",
        "center"
    ];
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    display: block;
    margin-bottom: 10px;
    width: 200px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 250px;">
        <div class="dx-fieldset-header">Position</div>
        <div class="dx-field">
            <div class="dx-field-label">my</div>
            <div class="dx-field-value" data-bind="dxSelectBox: {
                dataSource: positionValues,
                value: myValue
            }"></div>
        </div>
        <div class="dx-field">
            <div class="dx-field-label">at</div>
            <div class="dx-field-value" data-bind="dxSelectBox: {
                dataSource: positionValues,
                value: atValue
            }"></div>
        </div>
    </div>
    <div class="ui-element" data-bind="dxButton: {
        text: 'Show context menu',
        onClick: showMenu
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        invokeOnlyFromCode: true,
        visible: menuVisible,
        position: {
            my: myValue,
            at: atValue
        }
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuVisible: ko.observable(false),
    showMenu: function () {
        this.menuVisible(true);
    },
    myValue: ko.observable("left top"),
    atValue: ko.observable("center"),
    positionValues: [
        "left top",
        "top",
        "right top",
        "right",
        "right bottom",
        "bottom",
        "left bottom",
        "left",
        "center"
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    display: block;
    margin-bottom: 10px;
    width: 200px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 250px;">
        <div class="dx-fieldset-header">Position</div>
        <div class="dx-field">
            <div class="dx-field-label">my</div>
            <div class="dx-field-value" id="mySelector"></div>
        </div>
        <div class="dx-field">
            <div class="dx-field-label">at</div>
            <div class="dx-field-value" id="atSelector"></div>
        </div>
    </div>
    <div class="ui-element" id="showMenuButton"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
var positionValues = [
        "left top",
        "top",
        "right top",
        "right",
        "right bottom",
        "bottom",
        "left bottom",
        "left",
        "center"
];
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    position: {
        my: "left top",
        at: "center"
    }
});
$("#mySelector").dxSelectBox({
    dataSource: positionValues,
    value: "left top",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("position.my", e.value);
    }
});
$("#atSelector").dxSelectBox({
    dataSource: positionValues,
    value: "center",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("position.at", e.value);
    }
});
$("#showMenuButton").dxButton({
    text: "Show context menu",
    onClick: function () {
        $("#myContextMenu").dxContextMenu("instance").show();
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    display: block;
    margin-bottom: 10px;
    width: 200px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}

rtlEnabled

Specifies whether or not the current component supports a right-to-left representation.

Type: Boolean
Default Value: false

If you need to switch the display of this DevExtreme component to right-to-left, enable a specifically designed configuration option - rtlEnabled. When this option is set to true, the text flows from right to left, and the layout the component's elements is reversed. To switch the entire application/site to a right-to-left representation, use the static DevExpress.rtlEnabled field.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="ui-element" dx-check-box="{
        text: 'rtlEnabled',
        bindingOptions: {
            value: 'menuRtl'
        }
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        bindingOptions: {
            rtlEnabled: 'menuRtl'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuRtl = false;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" data-bind="dxCheckBox: { value: menuRtl, text: 'rtlEnabled' }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        rtlEnabled: menuRtl
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuRtl: ko.observable(false)
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" id="disabledSelector"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget'
});
$("#disabledSelector").dxCheckBox({
    value: false,
    text: "rtlEnabled",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("rtlEnabled", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

selectedItem

The selected item object.

Type: Object
Default Value: null

selectedItems

An array of currently selected item objects.

Type: Array

selectionByClick

Specifies whether or not an item becomes selected if an end-user clicks it.

Type: Boolean
Default Value: false

selectionMode

Specifies the selection mode supported by the menu.

Type: String
Default Value: none
Accepted Values: "single"|"none"

showSubmenuMode

Specifies options of submenu showing and hiding.

Type: Object
Default Value: { name: "onHover", delay: { show: 0, hide: 0 } }

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">showSubmenuMode</div>
            <div class="dx-field-value" dx-select-box="{
                dataSource: showModes,
                bindingOptions: {
                    value: 'showMode'
                }
            }"></div>
        </div>
    </div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        bindingOptions: {
            visible: 'menuVisible',
            showSubmenuMode: 'showMode'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.showMode = "onHover";
    $scope.showModes = ["onHover", "onHoverStay", "onClick"];
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">showSubmenuMode</div>
            <div class="dx-field-value" data-bind="dxSelectBox: {
                dataSource: showModes,
                value: showMode
            }"></div>
        </div>
    </div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        showSubmenuMode: showMode
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    showMode: ko.observable("onHover"),
    showModes: ["onHover","onHoverStay","onClick"]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">showSubmenuMode</div>
            <div class="dx-field-value" id="showModeSelector"></div>
        </div>
    </div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    position: {
        my: "left top",
        at: "center"
    }
});
$("#showModeSelector").dxSelectBox({
    dataSource: ["onHover", "onHoverStay", "onClick"],
    value: "onHover",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("showSubmenuMode", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 500px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
    margin-top: 20px;
}

submenuDirection

Specifies the direction at which submenus are displayed.

Type: String
Default Value: "auto"
Accepted Values: "auto"|"right"|"left"

By default, the submenus of the context menu are displayed so that they are visible totally, based on the widget location on the page. Use the submenuDirection option to display submenus to the left or to the right from the context menu.

tabIndex

Specifies the widget tab index.

Type: Number
Default Value: 0

target

The target element associated with a popover.

Default Value: window

Specify this option to indicate the element for which the context menu will be invoked. This option can take on one of the following values.

JavaScript
//CSS selector
target: '#targetElement';

//jQuery wrapper
target: $('#targetElement');

//DOM element
target: document.getElementById('targetElement');

To align the context menu near this element, use the position option.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">Choose target</div>
            <div class="dx-field-value" dx-select-box="{
                dataSource: targets,
                displayExpr: 'name',
                valueExpr: 'id',
                bindingOptions: {
                    value: 'menuTarget'
                }
            }"></div>
        </div>
    </div>
    <div id="target1"></div>
    <div id="target2"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        bindingOptions: {
            target: 'menuTarget'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuTarget = "#target1";
    $scope.targets = [
        { name: "Left image", id: "#target1" },
        { name: "Right image", id: "#target2" }
    ];
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

#target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

#target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">Choose target</div>
            <div class="dx-field-value" data-bind="dxSelectBox: {
                dataSource: targets,
                displayExpr: 'name',
                valueExpr: 'id',
                value: menuTarget
            }"></div>
        </div>
    </div>
    <div id="target1"></div>
    <div id="target2"></div>
    <div data-bind="dxContextMenu: { 
        dataSource: menuItems,
        target: menuTarget
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuTarget: ko.observable("#target1"),
    targets: [
        { name: "Left image", id: "#target1" },
        { name: "Right image", id: "#target2" }
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

#target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

#target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}
<div class="demo-page">
    <div class="dx-fieldset" style="width: 350px;">
        <div class="dx-field">
            <div class="dx-field-label">Choose target</div>
            <div class="dx-field-value" id="targetSelector"></div>
        </div>
    </div>
    <div id="target1"></div>
    <div id="target2"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#target1'
});
$("#targetSelector").dxSelectBox({
    dataSource: [
        { name: "Left image", id: "#target1" },
        { name: "Right image", id: "#target2" }
    ],
    displayExpr: 'name',
    valueExpr: 'id',
    value: "#target1",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("target", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

#target1 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
}

#target2 {
    background-image: url(/Content/images/doc/14_2/PhoneJS/headphone.jpg);
    background-size: cover;
    float: left;
    height: 150px; 
    width:100px; 
    margin-left: 150px;
}

visible

A Boolean value specifying whether or not the widget is visible.

Type: Boolean
Default Value: false

Use this option to display/hide a context menu in code.

Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="ui-element" dx-check-box="{
        text: 'visible',
        bindingOptions: {
            value: 'menuVisible'
        }
    }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        bindingOptions: {
            visible: 'menuVisible'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ];
    $scope.menuVisible = false;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" data-bind="dxCheckBox: { value: menuVisible, text: 'visible' }"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        visible: menuVisible
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    menuVisible: ko.observable(false)
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="ui-element" id="disabledSelector"></div>
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    onHidden: function () {
        $("#disabledSelector").dxCheckBox("instance").option("value", false);
    },
    onShown: function () {
        $("#disabledSelector").dxCheckBox("instance").option("value", true);
    }
});
$("#disabledSelector").dxCheckBox({
    value: false,
    text: "visible",
    onValueChanged: function (e) {
        $("#myContextMenu").dxContextMenu("instance").option("visible", e.value);
    }
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ui-element{
    margin-bottom: 10px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}

width

Specifies the width of the widget.

Type: Number|String|function
Return Value: Number|String
The widget width.
Default Value: undefined

The option can hold a value of the following types.

  • numeric
    The widget width in pixels.
  • string
    A CSS measurement of the widget width (e.g., "55px", "80%", "auto" and "inherit").
  • function
    The function returning the widget width. For example, see the following code.

    JavaScript
    width: function () { 
        return baseWidth - 10 + "%";
    }
Show Example:
AngularJS
Knockout
jQuery
<div class="demo-page" ng-controller="demoController">
    <div class="target" id="contextMenuTarget"></div>
    <div dx-context-menu="{
        dataSource: menuItems,
        target: '#contextMenuTarget',
        width: 200
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.menuItems = [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div data-bind="dxContextMenu: {
        dataSource: menuItems,
        target: '#contextMenuTarget',
        width: 200
    }"></div>
</div>
var myViewModel = {
    menuItems: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ]
};
ko.applyBindings(myViewModel);
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}
<div class="demo-page">
    <div class="target" id="contextMenuTarget"></div>
    <div id="myContextMenu"></div>
</div>
$("#myContextMenu").dxContextMenu({
    dataSource: [
        { text: 'Increase' },
        {
            text: 'Share',
            items: [
                { text: 'Send to a friend' },
                { text: 'Send to a group' }]
        },
        { text: 'Download' },
        { text: 'Comment' },
        { text: 'Favorite' }
    ],
    target: '#contextMenuTarget',
    width: 200
});
.demo-page{
    background-color: #F0F0F0;
    height: 400px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.target {
    background-image: url(/Content/images/doc/14_2/PhoneJS/cherry.jpg);
    background-size: cover;
    height: 150px; 
    width:100px; 
}