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?



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;



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

if (this._rangeEnabledDays[time] == true)
this.contDates.childNodes[q].childNodes[w]._css_dis = false;
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.



hei SteveLuteijn,

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

hey, it’s work great!

thanx bro