Back to Devexpress

ASPxClientGantt.ScaleCellPrepared Event

aspnet-js-aspxclientgantt-74f8c0bd.md

latest3.6 KB
Original Source

ASPxClientGantt.ScaleCellPrepared Event

Occurs after a scale cell is prepared.

Declaration

ts
ScaleCellPrepared: ASPxClientEvent<ASPxClientGanttScaleCellPreparedEventHandler<ASPxClientGantt>>

Event Data

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

PropertyDescription
endDateGets the end date of the scale cell.
scaleElementSpecifies a scale cell.
scaleIndexThe scale’s index.
scaleTypeGets the view type of the scale.
separatorElementSpecifies the separator element between scale cells.
startDateGets the start date of the scale cell.

Remarks

Handle the ScaleCellPrepared event to customize the scale’s cells and separators.

The code sample below illustrates how to color separators and the scale’s top and bottom cells:

Web Forms:

aspx
<dx:ASPxGantt runat="server" ID="Gantt" ClientInstanceName="clientGantt" >
    <SettingsTaskList>
        <Columns>
           <!-- ... -->
        </Columns>
    </SettingsTaskList>
    <ClientSideEvents 
        ScaleCellPrepared = "onGanttScaleCellPrepared"
    />
</dx:ASPxGantt>
js
function onGanttScaleCellPrepared(s, e) {
    var scaleElement = e.scaleElement;
    if (e.scaleIndex === 0)
        scaleElement.style.backgroundColor = "Silver";
    else 
        scaleElement.style.backgroundColor = "LightSteelBlue";
    var border = e.separatorElement;
    border.style.borderColor = "SteelBlue";
}

MVC:

cshtml
@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.ClientSideEvents.ScaleCellPrepared = "function (s, e) { 
        var scaleElement = e.scaleElement;
        if (e.scaleIndex === 0)
            scaleElement.style.backgroundColor = "Silver";
        else 
            scaleElement.style.backgroundColor = "LightSteelBlue";
        var border = e.separatorElement;
        border.style.borderColor = "SteelBlue";
    }";
    ...
}).Bind(
    GanttDataProvider.Tasks, GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments
).GetHtml()

Limitation

  • When the DevExpress.Web.ASPxGantt control uses built-in export to PDF, it does not export your custom content specified in a ScaleCellPrepared event handler.

See Also

ASPxGantt - Overview

MVCxGantt - Overview

ASPxGantt - 'How To' Examples

MVCxGantt - 'How To' Examples

ASPxClientGantt Class

ASPxClientGantt Members