ASPxClientGantt.ScaleCellPrepared Event
Occurs after a scale cell is prepared.
Declaration
ScaleCellPrepared: ASPxClientEvent<ASPxClientGanttScaleCellPreparedEventHandler<ASPxClientGantt>>
Event Data
The ScaleCellPrepared event's data class is ASPxClientGanttScaleCellPreparedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
endDate | Gets the end date of the scale cell. |
scaleElement | Specifies a scale cell. |
scaleIndex | The scale’s index. |
scaleType | Gets the view type of the scale. |
separatorElement | Specifies the separator element between scale cells. |
startDate | Gets 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:
<dx:ASPxGantt runat="server" ID="Gantt" ClientInstanceName="clientGantt" >
<SettingsTaskList>
<Columns>
<!-- ... -->
</Columns>
</SettingsTaskList>
<ClientSideEvents
ScaleCellPrepared = "onGanttScaleCellPrepared"
/>
</dx:ASPxGantt>
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:
@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