Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mahesh on Oct 23, 2009 00:59
open dhtmlx forum
dhtmlx scheduler and setting backround color when duration of event exceeds 5 hours?

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;
    }
Answer posted by Stanislav (support) on Oct 23, 2009 02:46
It must be
   if ((end.getHours()-start.getHours()) > 5)

Also, above check doesn't take the dates in account, so it still not perfect. 
Answer posted by Stanislav (support) on Oct 23, 2009 02:47
>>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.