The onBeforeCellExport event handler fires during image export and lets you set a custom background color for the exported cell.

Declaration

DayPilot.Calendar.onBeforeCellExport(args)

Parameters

  • args.areas (DayPilot.AreaData[]): active areas for image export

  • args.cell - exported grid cell object (read-only)

  • args.backColor (string) - exported cell background color

Notes

The export prepares cell content using onBeforeCellRender before calling this handler. Use this handler for export-only text or appearance changes.

Active Areas in Image Export

For PNG, JPEG and SVG export, args.areas contains copies of the active-area descriptors prepared for this item. Replace it or assign [] to change only the exported areas. The export does not call an area’s onAfterRender DOM callback. Custom HTML remains outside the supported image-export representation.

Examples

JavaScript

const calendar = new DayPilot.Calendar("dp", {
  onBeforeCellExport: (args) => {
    args.backColor = "white";
  },
  // ...
});
calendar.init();

Angular

<daypilot-calendar [config]="config"></daypilot-calendar>
config: DayPilot.CalendarConfig = {
  onBeforeCellExport: (args) => {
    args.backColor = "white";
  },
  // ...
};

React

<DayPilotCalendar
  onBeforeCellExport={onBeforeCellExport}
/>
const onBeforeCellExport = (args) => {
  args.backColor = "white";
};

Vue

<DayPilotCalendar
  :onBeforeCellExport="onBeforeCellExport"
/>
const onBeforeCellExport = (args) => {
  args.backColor = "white";
};

See Also

DayPilot.Calendar.onBeforeCellRender

DayPilot.Calendar Class

Availability

Availability of this API item in DayPilot editions:

ProductLitePro
DayPilot for JavaScript