search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Problem with events and resources background

Related article: JavaScript/HTML5 Scheduler PDF Export (Paged by Month)
Asked by Arpine
2 years ago.

Hello,
I have a problem with events and resources backgrounds. For some of my events, I use the repeating-linear-gradient() CSS function. It works great, but when I do my export, I have a black background.
For the resources, the background stays always white.
Hope that you have a solution.

Thank you in advance.

Answer posted by Dan Letecky [DayPilot]
2 years ago.

The image export only supports a limited set of CSS styles. The Scheduler tries to detect the background color but if you use an unsupported background style it will fail.

You can override the auto-detected background color using onBefore*Export event handlers (use args.backColor property):

https://api.daypilot.org/daypilot-scheduler-onbeforeeventexport/
https://api.daypilot.org/daypilot-scheduler-onbeforecellexport/

Comment posted by Arpine
2 years ago.

Thank you for your quick reply.
I try it, but it doesn't work, maybe I need to do another refresh process?

Comment posted by Dan Letecky [DayPilot]
2 years ago.

Please make sure that you have the latest DayPilot Pro version and try the following code:

dp.onBeforeCellExport = function(args) {
  args.backColor = "#cccccc";
};

dp.onBeforeEventExport = function(args) {
  args.backColor = "#ff0000";
};
Comment posted by Arpine
2 years ago.

Just with this code it's did'n work
dp.onBeforeEventExport = function(args) {
args.backColor = "#ff0000";
};
I try like this
dp.onBeforeEventExport = function(args) {
args.backColor = "#ff0000";
args.e.data.backColor = args.backColor;
};
It updates my schedule after export.
My version of DayPilot Pro is 2279. What should I do to get the latest version?

Comment posted by Dan Letecky [DayPilot]
2 years ago.

> What should I do to get the latest version?

You can purchase a license here:
https://javascript.daypilot.org/buy/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.