I’m having problems rebuilding my column list. I’ve set up a scheduler really as a weekly timetable, not interested in the day, month views etc. Perhaps there’s a more elegant way rather than adding lots of weeks then ignoring all the days I don’t need?
Anyway, It’s all fine but when I delete one of my dates, I’m calling all the scheduler setup again, including code below and init. But then two columns have gone, not just one. Any ideas? Thanks
// num_weeks - might be 12 for example
// dates_obj[] is my array of required dates
scheduler.attachEvent("onTemplatesReady",function(){
scheduler.date.workweek_start = scheduler.date.week_start;
scheduler.date.get_workweek_end=function(date){
return scheduler.date.add(date,7*num_weeks,"day");
};
for(var i = 0; i < num_weeks; i++){
scheduler.date.add_workweek=function(date,inc){
return scheduler.date.add(date,inc*7,"day");
};
}
scheduler.templates.workweek_date = scheduler.templates.week_date;
scheduler.templates.workweek_scale_date = scheduler.date.date_to_str("%j %M");
});
//hide days not required
scheduler.ignore_workweek = function(date){
var sched_date = date.getTime();
for(var i = 0; i < num_weeks; i++){ // go through my list of required dates
var my_date = dates_obj[i].date_id ;
if (sched_date == my_date )
return false;
}
return true;
};
Probably this issue occurs because you are filtering all dates excluding the ones inside the array with this code:
scheduler.ignore_workweek = function(date){
var sched_date = date.getTime();
for(var i = 0; i < num_dates; i++){
var e = datesIDs[i];
if (sched_date == e )
return false;
}
return true;
};
As returning true means that date will be blocked, if you will change it to follows:
scheduler.ignore_workweek = function(date){
var sched_date = date.getTime();
for(var i = 0; i < num_dates; i++){
var e = datesIDs[i];
if (sched_date == e )
return true;
}
return false;
};
The problem should be fixed.
Here is the updated snippet :
If I misunderstood, could you please reproduce the issue in the snippet above(open the snippet above => reproduce the issue on “HTML/CODE” tabs => click the share button)?
Thanks so much for this. It’s odd the original page didn’t show but I’ve edited the snippet to do what I want now: http://snippet.dhtmlx.com/5/0c1d28a3c
I wanted to delete a particular week. The true and false lines were the right way round - but by calling Render rather than Init it seems to work fine.
Cheers
Greg
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan