Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David Keenan on Mar 04, 2009 08:58
open dhtmlx forum
Double Calendar - Allow left calendar to show and select dates after right calendar date

Hi,

I am looking for a bit of help with a issue I just can't seem to get round.

I have a double calendar on the webpage and I want to allow the user to show and select a date on the left calendar that is after the date selected on the right calendar, how do I achieve this?

Thanks
Answer posted by Alex (support) on Mar 04, 2009 09:48

Hi, 

It is possible to set onClick event handlers to left and right calendars separately:

dblCal.rightCalendar.attachEvent("onClick",function(date){

/*your code here*/

})
dblCal.leftCalendar.attachEvent("onClick",function(date){

/*your code here*/

})

Answer posted by Support on Mar 04, 2009 09:54
Dates limitation behavior is hardcoded for dblCalendar, the only way to disable it - comment below lines in dhtmlxcalendar.js

dhtmlxDblCalendarObject.prototype.doOnCLeftClick = function(date){
    date = new Date (date)
    this._dblC.rightCalendar.setSensitive(date, null);

dhtmlxDblCalendarObject.prototype.doOnCRightClick = function(date){
    this._dblC.leftCalendar.setSensitive(null, date);



Answer posted by David Keenan on Mar 04, 2009 18:47

Thanks for your solutions.

To get the result I was looking for, I found that a very small edit worked, changing the date to null, so the left cal is open ended until the right cal is selected; even when there are initial dates in both cals, see below.

dhtmlxDblCalendarObject.prototype.setDate = function(dateFrom,dateTo)
{
this.leftCalendar.setDate(dateFrom);
this.rightCalendar.setDate(dateTo);
this.leftCalendar.setSensitive(null, null);
this.rightCalendar.setSensitive(this.leftCalendar.date, null)
};

I want to take it a step forward and get the right cal to move to the corresponding left date (when left date selected or reselected).

I appreciate any help you can give,

Thanks Again.

Answer posted by Alex (support) on Mar 05, 2009 01:57

The described behaviour is the same as the default one. When you select date in the left calendar, the sensitive date range for the right calendar is set automatically. 

If you want to define another behaviour, you can use onClick event handler of the left calendar.