I am trying to created a purple background when an item/resource is scheduled for more than 5 hours to block that resouce. I think the if conditional needs to be revised:
Is there also a way to insert the description field when this occurs?
scheduler.templates.event_class=function(start,end,event){
if ((end-start) > 5) //if more than 5 hours assume rad is blocked
return “block_rad”; //then set special css class for it
}
scheduler.load(“php/ir_events.php?uid=”+scheduler.uid());
/event in day or week view/
.dhx_cal_event.block_rad div{
background-color:purple!important;
color:white !important;
}
It must be
if ((end.getHours()-start.getHours()) > 5)
Also, above check doesn’t take the dates in account, so it still not perfect.
Is there also a way to insert the description field when this occurs?
Do you mean - set specific description for such events?
event.description = “any text”;
But it has sense to place such code in onEventChanged not in event_class template.