All docs
V21.2
21.2
21.1
20.2
20.1
The page you are viewing does not exist in version 20.1.
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.

ASPxClientGanttContextMenuItem Class

A context menu item.

Declaration

declare class ASPxClientGanttContextMenuItem

Remarks

The ASPxGantt allows you to customize the built-in (ContextMenuCustomization) or create a custom context menu (ContextMenu).

Run Demo: ASPxGantt - Context Menu Run Demo: MVCxGantt - Context Menu

The built-in context menu supports predefined and custom items. Use the CustomCommand event to handle clicks on custom items. You can call the Clear method to remove predefined items from the context menu.

Web Forms:

<dx:ASPxGantt ID="Gantt" ClientInstanceName="clientGantt" >
    //...
    <ClientSideEvents
      ContextMenuCustomization="function(s, e) {
          // Removes default context menu items
          e.menuItems.Clear();

          // Creates a custom context menu item
          var customItem = new ASPxClientGanttContextMenuItem();
          customItem.name = 'ToggleResourcesVisibility';
          customItem.text = 'Toggle Resources Visibility';
          customItem.beginGroup = true;

          // Adds a custom context menu item
          e.menuItems.Add(customItem);
      }
      CustomCommand="function(s, e) {
          if(e.commandName == 'ToggleResourcesVisibility') {
              showResources = !showResources;
              clientGantt.ShowResources(showResources);
          }
      }
    />
</dx:ASPxGantt>

MVC:

@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.ClientSideEvents.ContextMenuCustomization = "function (s, e) { 
        // Removes default context menu items
        e.menuItems.Clear();

        // Creates a custom context menu item
        var customItem = new ASPxClientGanttContextMenuItem();
        customItem.name = 'ToggleResourcesVisibility';
        customItem.text = 'Toggle Resources Visibility';
        customItem.beginGroup = true;

        // Adds a custom context menu item
        e.menuItems.Add(customItem);
    }";
    settings.ClientSideEvents.CustomCommand = "function (s, e) { 
        if(e.commandName == 'ToggleResourcesVisibility') {
            showResources = !showResources;
            clientGantt.ShowResources(showResources);
        }
    }";
    ...
}).Bind(
    GanttDataProvider.Tasks, GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments
).GetHtml()

Examples

See Also