Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Radhika on Dec 10, 2009 13:33
open dhtmlx forum
scheduler - limit the Start & End time dropdown values from a given start time to end time

Hi,
I have limited my day view to display schedules from 8 AM to 5 PM. However when I modify/create a new event, I see all the possible time values in the Lightbox i.e. from midnight to 12 AM.

How can I limit these dropdown values in the Lightbox as well from 8 AM to 5 PM or any other configurable value?

Thanks
Answer posted by Alex(support) on Dec 11, 2009 01:50

Hello,

you can try to apply the following approach

var setter = scheduler.form_blocks.time.set_value;
scheduler.form_blocks.time.set_value = function(node,value,ev){
 var selects = document.getElementsByTagName("select");
 selects[0].innerHTML = "";
 selects[4].innerHTML = "";
 var date = new Date();
 var dt = new Date(date.getYear(),date.getMonth(),date.getDate(),8,0);
 for (var i=60*8; i<60*17; i+=this.config.time_step*1){
  var time=this.templates.time_picker(dt);
  selects[0].options[selects[0].options.length] = new Option(time,i);
  selects[4].options[selects[4].options.length] = new Option(time,i);
  dt=this.date.add(dt,this.config.time_step,"minute");
 }
 setter.apply(this,arguments);
}


Answer posted by Radhika on Dec 11, 2009 07:16

Thanks for the quick reply. Tried this, but the line below, is causing an error - 'Object doesnt support this property or method'.

this.templates.time_picker(dt)

Any idea? I'm currently using version 2.

 

 

 

Answer posted by Alex (support) on Dec 11, 2009 07:27
time_picker template has been provided since 2.1 version.