JavaScript/jQuery Gantt - contextMenu
Type:
items[]
The context menu contains a set of default commands: 'addTask', 'taskDetails', and 'deleteTask'. Use the contextMenu property to recreate the context menu items.
To add a predefined item to the context menu, add its name and optional settings (for example, 'visible', 'text', and 'icon') to the items collection.
JavaScript
- $(function () {
- $("#gantt").dxGantt({
- contextMenu: {
- items: [
- "addTask",
- "deleteTask",
- {
- text: "Zoom",
- items: [
- "zoomIn",
- "zoomOut"
- ]
- }
- ]
- }
- //...
- });
- });
Custom Items
To add a custom context menu item, specify its text and optional settings (for example, name or category). Use the customCommand event to handle clicks on custom context menu items.
JavaScript
- $(function () {
- $("#gantt").dxGantt({
- contextMenu: {
- items: [
- {
- text: "Category",
- items:[
- {
- text: "Item 1",
- name: "item1"
- },
- {
- text: "Item 2",
- name: "item2"
- },
- {
- text: "Item 3",
- name: "item3"
- }
- ]
- }
- // ...
- ]
- }
- onCustomCommand: onCustomCommandClick
- // ...
- });
- });
- function onCustomCommandClick(e) {
- if(e.name == 'item1') {
- // your code
- }
- }
Result:
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.