Hi,
in the dhtmlxscheduler_minical.js in renderCalendar it calls:
...
var start = scheduler.date.month_start(date);
var end = scheduler.date.add(start, 1, "month");
var evs = this.getEvents(start, end);
var filter = this["filter_" + this._mode];
for (var i = 0; i < evs.length; i++) {
var ev = evs[i];
if (filter && !filter(ev.id, ev))
continue;
var d = ev.start_date;
if (d.valueOf() < start.valueOf())
d = start;
d = scheduler.date.date_part(new Date(d.valueOf()));
while (d < ev.end_date) {
this.markCalendar(cal, d, "dhx_year_event");
d = this.date.add(d, 1, "day");
if (d.valueOf() >= end.valueOf())
break;
}
}
...
if you link the calendar, would like to be able to link the calendar, and paint the events customly in an easy way. Without having to override the entire link and render functions.
I got 2 solutions, either we add/edit the following parts into dhtmlxscheduler_minical.js:
Move the “painting” code to a new function: scheduler._markCalendarEvents = function(cal, start, end) {
var evs = this.getEvents(start, end);
var filter = this["filter_" + this._mode];
for (var i = 0; i < evs.length; i++) {
var ev = evs[i];
if (filter && !filter(ev.id, ev))
continue;
var d = ev.start_date;
if (d.valueOf() < start.valueOf())
d = start;
d = scheduler.date.date_part(new Date(d.valueOf()));
while (d < ev.end_date) {
this.markCalendar(cal, d, "dhx_year_event");
d = this.date.add(d, 1, "day");
if (d.valueOf() >= end.valueOf())
break;
}
}
};
Add a configuration in the top with default value to call default paint function
scheduler.config.minicalendar_marker = scheduler._markCalendarEvents;
Replace the segment in renderCalendar with a call to the new config function.
...
var start = scheduler.date.month_start(date);
var end = scheduler.date.add(start, 1, "month");
scheduler.config.minicalendar_marker(cal, start, end);
...
Or another solution would be adding another event like:
...
var start = scheduler.date.month_start(date);
var end = scheduler.date.add(start, 1, "month");
scheduler.callEvent("onMarkMiniCalendar", [cal, start, end]);
...
And adding default
[code]scheduler.attachEvent(“onMarkMiniCalendar”, function (cal, start, end) {
var evs = this.getEvents(start, end);
var filter = this[“filter_” + this._mode];
for (var i = 0; i < evs.length; i++) {
var ev = evs[i];
if (filter && !filter(ev.id, ev))
continue;
var d = ev.start_date;
if (d.valueOf() < start.valueOf())
d = start;
d = scheduler.date.date_part(new Date(d.valueOf()));
while (d < ev.end_date) {
this.markCalendar(cal, d, “dhx_year_event”);
d = this.date.add(d, 1, “day”);
if (d.valueOf() >= end.valueOf())
break;
}
}
return true;
});[/code]
However attaching by event would still run the default marker even which might be unnecessary if the user would like to color all the days by himself. Either user would overpaint it again and we just wasted performance or maybe he doesn’t want to mark those days.
By the first solution the user could call scheduler._markCalendarEvents(cal,start,end) after their own painting method to use the default as well.