Scheduler Month View - Change Cell Background By Event Data

I am using the Scheduler with month view, and i need to change background of cells with events by some event property how to do this?


if you mean the month calendar cells, you can use month_date_class template:

It’s called for each cell and allows you to add a css class to the whole cell element.
You can inspect events located in a said cell (by getting events by date using scheduler.getEvents(from, to)), and return an appropriate class

scheduler.templates.month_date_class = function(date){
  var events = scheduler.getEvents(date,, 1, "day"));
     console.log(date, "no-events", events, events.length);
     return "no-events"; 
  }else if(events.length <= 2){
    console.log(date, "few-events", events, events.length);
     return "few-events"; 
    console.log(date, "many-events", events, events.length);
     return "many-events"; 
  return "";

Demo: (see the HTML tab for css)

Also, please note, that this template is called only during a complete repaint of the scheduler.
You may need to trigger complete repaints manually:

function refreshMonthLayout(){
   if(scheduler.getState().mode === "month"){
   return true;
scheduler.attachEvent("onParse", refreshMonthLayout);
scheduler.attachEvent("onEventChanged", refreshMonthLayout);
scheduler.attachEvent("onEventAdded", refreshMonthLayout);
scheduler.attachEvent("onEventDeleted", refreshMonthLayout);

Thanks for answer but this example not working for me.
I have enterprise license js version: 4.4
If its because i have older version let me know how to get the new version with my enterprise license.
And if the problem is not because the version let me know what can i do.
As i checked on the “month_date_class” event there is no events at all but if i try to console the events in timeout of 100 miliseconds i can see them.
Wating to your answer.

Thanks for helping.


can you please try replacing onParse with onXLE?

scheduler.attachEvent("onParse", refreshMonthLayout);


scheduler.attachEvent("onXLE", refreshMonthLayout);

onParse was added in v5.2, dhtmlxscheduler v4.4 didn’t have it. Probably that’s the reason why the sample didn’t work for you.

As for the update to the latest version of the scheduler - can you please drop us an email at and be sure to specify your license number and/or an email address you used to obtain the license back then.