Back to Devexpress

ASPxClientGantt.CustomCommand Event

aspnet-js-aspxclientgantt-69ef1bf6.md

latest2.9 KB
Original Source

ASPxClientGantt.CustomCommand Event

Enables you to implement a custom command’s logic.

Declaration

ts
CustomCommand: ASPxClientEvent<ASPxClientGanttCustomCommandEventHandler<ASPxClientGantt>>

Event Data

The CustomCommand event's data class is ASPxClientGanttCustomCommandEventArgs. The following properties provide information specific to this event:

PropertyDescription
commandNameSpecifies the command name for a custom toolbar item.
parameterGets an optional parameter that complements the processed command.

Remarks

You can use the CustomCommand event to handle clicks on custom toolbar and context menu items.

Web Forms:

aspx
<dx:ASPxGantt ID="Gantt" ClientInstanceName="clientGantt" >
    <SettingsToolbar>
        <Items>
            <dx:GanttCustomToolbarItem Checked="True" Text="Show Resources" CommandName="Toggle" />
        </Items>
    </SettingsToolbar>
    <ClientSideEvents CustomCommand="function(s, e) {
        if(e.commandName == 'Toggle') {
            clientGantt.ShowResources(e.parameter);
        }
    }" />
</dx:ASPxGantt>

MVC:

cshtml
@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.SettingsToolbar.Items.AddCustomItem(i => {
        i.Checked = true;
        i.Text = "Show Resources";
        i.CommandName = "ShowResources";
    });    
    settings.ClientSideEvents.CustomCommand = "function (s, e) { 
        if(e.commandName == 'Toggle') {
            clientGantt.ShowResources(e.parameter);
        }      
    }";
    ...
}).Bind(
    GanttDataProvider.Tasks, GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments
).GetHtml()

Examples

See Also

ASPxGantt - Overview

MVCxGantt - Overview

ASPxGantt - 'How To' Examples

MVCxGantt - 'How To' Examples

ASPxClientGantt Class

ASPxClientGantt Members