Hi,
I need a feature for my dhtmlxScheduler where certain events are highlighted in a different colour on an event. To get a better picture, I am using this plugin for an exam timetabling UI and I need to add a feature where, when a user highlights an event (in my case an exam), the other events which clash with that event are coloured in the same colour.
I am trying to set event.color on success of an ajax request but the event only gets colored when i click on it.
$.ajax({
type: ‘GET’,
url: ‘getEvents’,
data:
{
unitCode: unitCode
},
dataType: ‘json’,
success: function (data)
{
var ev = scheduler.getEvent(data);
ev.color = “#FF9933”;
}
});
is there something else i can do to to do this?
Thanks a lot and thanks for your awesome plugin!
please note that this piece of code worked:
scheduler.attachEvent(“onClick”, function (id, e){
var ev = scheduler.getEvent(id);
ev.color = "red";
return true;
});
but the same 3 lines on ajax success doesn’t work instantly. i have to either click on the event (which isn’t desired) or it works when I press F12 to open or close developer tools in chrome for some reason :S
Hi,
the color property is applied when the event is rendered to calendar.
So you need to invoke redrawing of an event when setting a color in ajax callback
Add one of following lines
scheduler.updateEvent(eventId);//redraw one
scheduler.setCurrentView();//redraw all
If you setting a colors after events are loaded from the server via scheduler.load, you may use onEventLoading event and assign color there, then it won’t require manual refresh
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … tview.html
docs.dhtmlx.com/scheduler/api__s … event.html
Thanks a lot for your reply! I will get back to you if I have any queries