The onBeforeCellRender event handler fires before a grid cell is rendered. You can use this event to customize the appearance of JavaScript Scheduler grid cells. See also cell customization.
DayPilot.Scheduler.onBeforeCellRender(args)
args.cell.displayY (number) - vertical index in the grid, excludes hidden rows (read-only)args.cell.end (DayPilot.Date) - cell end (read-only)args.cell.events() - returns an array of events that overlap this cellargs.cell.grid ("top" | "main" | "bottom") - grid id (read-only)args.cell.isParent (boolean) - true for cells in parent rows (read-only)args.cell.properties (object) - cell properties (see below)args.cell.resource (number | string) - resource ID (read-only)args.cell.row (DayPilot.Row) - row object (available since 2023.1.5516)args.cell.start (DayPilot.Date) - cell start (read-only)args.cell.utilization(fieldName) - calculates utilization using the specified field of the event data objectargs.cell.x (number) - horizontal position/index in the grid (read-only)args.cell.y (number) - vertical position/index in the grid, includes hidden rows (read-only)Properties (args.cell.properties):
areas (array of area objects)backColor (string) - custom cell background color, e.g. "#ccc" or "red"backImage (string) - background image URLbackRepeat (string) - background-repeat stylebusiness (boolean) - business/non-business statuscssClass (string) - custom cell CSS classdisabled (boolean) - disables the cell for drag and dropfontColor (string) - foreground color (available since 2023.3.5631)html (string) - custom cell raw HTMLtext (string) - custom text that will be HTML-encoded (available since 2023.3.5631)const dp = new DayPilot.Scheduler("dp", {
onBeforeCellRender: (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#dddddd";
}
},
// ...
});
dp.init();
<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
onBeforeCellRender: (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#dddddd";
}
},
// ...
};
<DayPilotScheduler
onBeforeCellRender={(args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#dddddd";
}
}}
{/* ... */}
/>
<DayPilotScheduler @beforeCellRender="onBeforeCellRender" <!-- ... --> />
const onBeforeCellRender = (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#dddddd";
}
};Availability of this API item in DayPilot editions:
| Lite | Pro | |
|---|---|---|
| DayPilot for JavaScript |
Lite args missing: control, getPixels