Back to Devexpress

ASPxClientGantt.TaskShowing Event

aspnet-js-aspxclientgantt-ed3c778a.md

latest3.2 KB
Original Source

ASPxClientGantt.TaskShowing Event

Occurs before a task is displayed.

Declaration

ts
TaskShowing: ASPxClientEvent<ASPxClientGanttTaskShowingEventHandler<ASPxClientGantt>>

Event Data

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

PropertyDescription
cancelSpecifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
containerReturns a container for the task’s content.
itemContains information about a task object and its settings.

Remarks

Use the TaskShowing event to specify custom content for the processed task or cancel the task display (the cancel argument).

Run Demo: ASPxGantt - Client-Side Events Run Demo: MVCxGantt - Client-Side Events

Web Forms:

aspx
<dx:ASPxGantt ID="Gantt" >
    <ClientSideEvents TaskShowing="function(s, e) {
        var customContainer = document.createElement("div");  
        customContainer.classList.add("custom-task");  
        customContainer.setAttribute("style", "width:" + e.item.taskSize.width + "px;");  
        customContainer.textContent = e.item.taskData["Subject"];  
        e.container.appendChild(customContainer);
    }" />
</dx:ASPxGantt>

MVC:

cshtml
@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.ClientSideEvents.TaskShowing = "function (s, e) { 
        var customContainer = document.createElement("div");  
        customContainer.classList.add("custom-task");  
        customContainer.setAttribute("style", "width:" + e.item.taskSize.width + "px;");  
        customContainer.textContent = e.item.taskData["Subject"];  
        e.container.appendChild(customContainer);    
    }";
    ...
}).Bind(
    GanttDataProvider.Tasks, GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments
).GetHtml()

Concepts

See Also

ASPxGantt - Overview

MVCxGantt - Overview

ASPxGantt - 'How To' Examples

MVCxGantt - 'How To' Examples

ASPxClientGantt Class

ASPxClientGantt Members