The onBeforeTimeHeaderRender event handler fires before a Gantt time header cell is rendered and lets you customize the time header content and appearance.
Declaration
DayPilot.Gantt.onBeforeTimeHeaderRender(args)Parameters
args.header.areas(array) - active areasargs.header.backColor(string) - background colorargs.header.cssClass(string) - custom CSS classargs.header.end(DayPilot.Date) - cell end (read-only)args.header.html(string) - custom HTMLargs.header.level(number) - header row index (read-only, zero-based)args.header.start(DayPilot.Date) - cell start (read-only)args.header.toolTip(string) - tooltip text
Notes
Use args.header.level to distinguish individual time header rows when multiple levels are displayed. The args.header.start and args.header.end values are read-only.
Examples
JavaScript
const gantt = new DayPilot.Gantt("dp", {
onBeforeTimeHeaderRender: (args) => {
if (args.header.start.getDayOfWeek() === 6) {
args.header.html = "Sat";
}
},
// ...
});
gantt.init();Angular
<daypilot-gantt [config]="config"></daypilot-gantt>config: DayPilot.GanttConfig = {
onBeforeTimeHeaderRender: (args) => {
if (args.header.start.getDayOfWeek() === 6) {
args.header.html = "Sat";
}
},
// ...
};React
<DayPilotGantt
onBeforeTimeHeaderRender={onBeforeTimeHeaderRender}
{/* ... */}
/>const onBeforeTimeHeaderRender = (args) => {
if (args.header.start.getDayOfWeek() === 6) {
args.header.html = "Sat";
}
};Vue
<DayPilotGantt
@beforeTimeHeaderRender="onBeforeTimeHeaderRender"
<!-- ... -->
/>const onBeforeTimeHeaderRender = (args) => {
if (args.header.start.getDayOfWeek() === 6) {
args.header.html = "Sat";
}
};See Also
DayPilot.Gantt.onBeforeTimeHeaderExport
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot