Enable multiple days DHTMLXCalendar

Hi there,

I am working with the calendar and want to enable certain days. I have a ajax solution which will give me only the days that are valid all others days are not. So i use setInsensitiveRange(‘1001-01-01’, null) to disable all days and then i want enable one or more days which are not in a range.

For example i only want the following days enabled: 2011-10-11, 2011-10-15 and 2011-10-23. All other days must be disabled. How would i achieve this?

Regards,

Steve

Well i did some coding myself. And i think i have found a solution. Here is a snippet of my code:

create a variable:
this._rangeEnabledDays = {}

add a little function:

this.setEnabledDay = function(d) {
var t = this._extractDates(d);
for (var q=0; q<t.length; q++) this._rangeEnabledDays[new Date(t[q].getFullYear(),t[q].getMonth(),t[q].getDate(),0,0,0,0).getTime()] = true;

    this._drawMonth(this._activeMonth);

}

and change the line:
this.contDates.childNodes[q].childNodes[w]._css_dis = this._isOutOfRange(time);

into:
if (this._rangeEnabledDays[time] == true)
{
this.contDates.childNodes[q].childNodes[w]._css_dis = false;
}else{
this.contDates.childNodes[q].childNodes[w]._css_dis = this._isOutOfRange(time);
}

now simply call foreach date you want to disable the setEnabledDay function. Don’t forget to disable all dates first :wink:

Maybe DHTMLX will add this to the DHTMLXCalendar in the future.

Regards,

Steve
Cheers!

hei SteveLuteijn,

where should i place your code, i’m facing the same problem with you :smiley:

hey, it’s work great!

thanx bro