Scheduler allows to define separate classes for separate days in the view. So it really possible to define different coloring schemes for different days.
samples/02_customization/02_days_coloring.html - shows how different classes can be assigned to the different dates
samples/02_customization/03_hours_coloring.html - shows how based on custom class - specific hours can be colored
Combining above two samples will allow to color days differently for each day.
The tricky part is “unit” - in unit view week_date_class will receive dates, instead of names of units, so to get the index of unit , you will need to use something similar to the next
var index = (scheduler._props[name].position||0)+Math.floor((date.valueOf()-scheduler._min_date.valueOf())/(606024*1000));
where name - name of units view mode ( same as param in createUnitsView command )
Alternatively, you can wait few days for the version 2.2, which has timeline view, where each time cell can be colored separately.
how can i make hours coloring from 12.00 PM till 13.00 PM?
do i need to make a different image for each unit/day… cant get the css to work…
can you make an example for me?
im using a timestep:
var step = 10;
scheduler.config.hour_size_px=(60/step)*42;
scheduler.templates.hour_scale = scheduler.templates.hour_scale
do i need to make a different image for each unit/day
Yep, this is the only way, because separate cells is not accessible you can set a bg image for whole day only.
For custom time-steps you will need a custom bg image ( one from the package will not suit for your needs ) , except of it there must not be any problems
Building custom images for every day won´t be a operable solution.
You can check timeline view, it allows to show event-per-property view, similar to units view, and in the same time, it allows to define color for each time cell separately.
add a “workinghours” event that is shown in the background
Unfortunately there is no way, except of serious code modification.
hi, thnx this is a great help… do you also know how i can make save diffent templates, for different days? (connected to days of the week, 1 for monday, 1 for for tuesday etc…)
Does anyone know how to color the cells differently in cell mode based on the section? I have this working in the normal timeline view but not in cell mode.
Or maybe a better question is what information can be extracted using this method:
[code] scheduler.templates.matrix_cell_class = function(ev,x,y){
if (!ev) {
var day = x.getDay();
return (day==0 || day == 6) ? “yellow_cell” : “white_cell”;
}
if (ev.length<3) return “green_cell”;
return "red_cell";
};[/code]
In other words, I know I can get ev.length but I’ve tried ev.section_id to no avail.
Thanks so much for your help–this works perfectly now! Below is a sample of what I was working on, basically wanting to color cells based on the event type. I’ve attached a sample screenshot of the final product.
//===============
//Customization
//===============
scheduler.templates.matrix_cell_class = function(evs,x,y){
if (!evs) {
var day = x.getDay();
return (day==0 || day == 6) ? "yellow_cell" : "white_cell";
}
for(var i=0; i<evs.length; i++){
var ev=evs[i];
if(ev.type=="A") return "A";
if(ev.type=="B") return "B";
if(ev.type=="C") return "C";
if(ev.type=="D") return "D";
if(ev.type=="E") return "E";
if(ev.type=="F") return "F";
if(ev.type=="G") return "G";
if(ev.type=="H") return "H";
if(ev.type=="I") return "I";
if(ev.type=="J") return "J";
if(ev.type=="K") return "K";
if(ev.type=="L") return "L";
if(ev.type=="M") return "M";
if(ev.type=="N") return "N";
if(ev.type=="O") return "O";
if(ev.type=="P") return "P";
if(ev.type=="Q") return "Q";
if(ev.type=="R") return "R";
if(ev.type=="S") return "S";
if(ev.type=="T") return "T";
if(ev.type=="U") return "U";
if(ev.type=="V") return "V";
if(ev.type=="W") return "W";
if(ev.type=="X") return "X";
if(ev.type=="Y") return "Y";
if(ev.type=="Z") return "Z";
}
};
scheduler.templates.matrix_scalex_class = function(date){
if (date.getDay()==0 || date.getDay()==6) return "yellow_cell";
return "";
}
scheduler.templates["matrix_cell_value"] = function(ar){ // ar = array of events for that cell or undefined
if(ar) { // there are some events
text = '';
for(var i=0; i<ar.length; i++)
text += "<p>"+ar[i].text+"</p>";
return text;
}
return "";
};
Just thought I would share for others wanting to do something similar.
Stanislav and Ilya. Would it be lot of work to make a simular function in to the original sheduler product? I think it would gain more custommers for your product