Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Nov 10, 2009 23:42
open dhtmlx forum
Setting date range for calendar.

I have created an object of dhtmlxCalendarObject. I want to add validation like, user should be able to select days only for current week. I tried using setSensitive api, but that did not work for me. I am using setSensitive api as:
mCal.setSensitive(new Date(minDate),new Date(maxDate)) where mCal is dhtmlxCalendarObject.

I have replaced my dhtmlxcalendar.js and dhtmlxcommon.js according to previous post:
http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=10634&ssr=yes&s=setsensitive


Answer posted by Alex (support) on Nov 11, 2009 02:47

You can try to use the following method:

var current = new Date();
var week_day = current.getDay();
var start = current.setDate(current.getDate()-week_day+1);
var end = current.setDate(current.getDate()+6);
calendar.setSensitive(new Date(start),new Date(end));

Answer posted on Nov 11, 2009 04:16
Is there any way that I can catch onclick event for inactive dates.?
Answer posted by Alex (support) on Nov 11, 2009 05:03
Unfortunately, it isn't possible.