Hi,
I found an issue which can be reproduced in demo “Hiding days in the scale of Week view” ( docs.dhtmlx.com/scheduler/sample … gnore.html ) by overloading ignore_week to hide first day of the week (eg. “monday” in my case).
scheduler.ignore_week = function(date){
if (date.getDay() == 1 || date.getDay() == 4) // here use 1 instead of 2 (in the demo)
return true;
};
In this way, the page crashes with a JavaScript report.
After some debugging, I noticed that the problem comes from the dhtmlxscheduler.js in the method scheduler._mouse_coords=function(ev){}.
(approx. line 2242) there is this block :
if (this._cols){
var column = pos.x / this._cols[0];
if (this._ignores)
for (var i=0; i<=column; i++)
if (this._ignores[i])
column++;
}
However, when first day is hidden (via filter_week) then this._cols[0] = 0 and the division fails with special Infinity value.
NB : Also, should the for condition not be strictly inferior (<) instead of (<=) ?
A proposition which seems solving the issue (filter the _cols property to keep columns having a width higher than 0 to get the column position) :
if (this._cols){
var displayedColumns = this._cols.filter(function(i){return (i > 0);});
var column = pos.x / displayedColumns[0];
if (this._ignores) {
for (var i=0; i<=column; i++) {
if (this._ignores[i]) {
column++;
}
}
}
}
Not sure about backward compatibilities or other extensions impact.