Different event header colour for each user

Hi, I have the scheduler running quite nicely on a simple standalone web page but I would now like to have a different coloured header for each of my users.

There are four users and an admin account that log in, and I would like each user to have their own colours (background and text colours) in the header of their events.

Iv seen a number of examples to colour the headers of events, but I cant seem to fathom out how to assign a different colour for each user.

Any help would be much appreciated.



You can use code like

scheduler.templates.event_class = function(s,e, ev){ return "user"+ev.userid; //will return user1 ... userN }

and in css

.dhx_cal_event.userA .dhx_header, .dhx_cal_event.userA .dhx_title{ background-color: red; }

Thanks for the reply - That code is almost what I already have, but for some reason it does not work (yours or mine!). This is what I already had:

scheduler.templates.event_class=function(start,end,event) { for(var i=0; i < CurrentUserArray.length-1; i++) { if (event.userId == CurrentUserArray[i]) { return "user_"+i; } $('.user_' + i + ' div').css({'background-color':BgColors[i],'color':'#000000'}); } }

With this my users events are coloured (and with some minor tweaking I can make the headers coloured instead of everything), but there is always one user who is not coloured at all and I cant seem to work out why.

Any ideas?



Ah! No worries - I got it sorted now - thanks Stanislav

hi MaxVk

I also want thet functionality for my project in which event color is based on users can u plz share the code