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

Target cell based on event type?

Asked by Tom
4 years ago.

Is there a way to target the cell which an event is in? I need to add a custom background colour for the cell based on what type of event is on that day.

This is in regard to using the calendar in month view.

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

You can use onBeforeCellRender event like this:

//...
dp.onBeforeCellRender = function(args) {
  var events = dp.events.forRange(args.cell.start, args.cell.end);

  // check events array for event types....
  // ...
  
  // has events?
  var hasEvents = !events.isEmpty();
  if (hasEvents) {
    args.cell.cssClass = "has-events";
  }
};
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.