Customization: Status ...

Hi.
I give every event a status:

scheduler.addEvent({
			id: "2",
			start_date: "31-03-2010 15:00",
			end_date: "31-03-2010 15:30",
			text: "my date",
			status: "ok"
		});
		
		scheduler.addEvent({
			id: "3",
			start_date: "31-03-2010 16:00",
			end_date: "31-03-2010 16:30",
			text: "my date 2",
			status: "canceled"			
				
		});

and i want to make something like:
status ok - background color is green
status canceled - background color is red

but i dont know (yet), how i can get the status of a event (on loading and on drawing)

thank you in advance
joerg

Hello,

you may try the following:

.dhx_cal_event.ok div{ background-color:green; } .dhx_cal_event.canceled div{ background-color:red; } ... scheduler.templates.event_class=function(start,end,event){ return event.status; } ...

what a great & fast support, thank you!!!

i fixed it first with a hack
in scheduler._render_v_bar = function(D, M, L, N, H, B, F, E, A) {

G += '<div class="dhx_body" style=" width:' + (N - (this._quirks ? 4 : 14)) + "px; height:" + (H - (this._quirks ? 6 : 16)) + 'px; background-color:'+K.status+';">' + E + "</div>";

and set the status in my definition to red or green and so on…
but your version is much much cooler and easier… and it’s still updateable if you have a newer version of dhtmlx out!!!

thanks you again!!

Hi,

Similarly, is there a way to do this without style sheets, as my colours aer stored in the DB dynamically:

scheduler.addEvent({ id: "2", start_date: "31-03-2010 15:00", end_date: "31-03-2010 15:30", text: "my date", status: "ok" bg_color: "background-color:rgb("+Color_BG_RGBValue+");", text_color: "color:rgb("+sColor_Text_RGBValue+");" });

Like the below?

scheduler.templates.event_style=function(start,end,event){ event.style.background_color = event.bg_color; event.style.color = event.color; }

Cheers.

Unfortunately it is not possible. If you are not using data-processor, there is a trick, how style string can be attached to the event, but it doesn’t supported in the common case.

( also , events in the day|week view are a complex structures, which built from multiple HTML elements - so single style string will be not good in any case )

try to play a little with my hack from above… this should be nearly the stuff you want…

That is the approach that I took, originally, but I need to “re-do” this everytime a dhtmlxscheduler.js file is released. Therefore it would be great if I could add it another way.

Never mind, back to the drawing board, thanks for your input.