Custom skins updating

I have a system where based on a property of an event (the value of ‘approved’), the colour of an event is different.

If approved is 0, the event is purple, but if approved is 1, the event is blue.

This loads correctly, but I have a checkbox in my ‘edit event’ box that stores the value of approved.
I have it that checked =3 and unchecked = 1, but if the event was originally 0 and the box is unchecked, it sets approved back to 0.
This all works in terms of setting the value in the database, but for some reason, the event colour goes to blue even when I set approved to 0.

Do you know why this is and how I can fix it?

Which code you are using to color events based on checkbox state ?

Each time, after lightbox closing event will be repainted, and if you are using color property or one of templates - new value will be applied. So if template|code is correct - there is no way, normally, to have wrong coloring.

I’m using this function:

scheduler.templates.event_class=function(start,end,event){ switch ( event.type ){ case “1” : return “some_event”; case “2” : return “other_event”; } }

Is that the correct one to use?

Above code has error in its logic, in JS code case instruction doesn’t stop exection until break encountered. So the valid code must be

scheduler.templates.event_class = function(start, end, event) { switch (event.type) { case "1": return "some_event"; break; //added case "2": return "other_event"; break; //added } }

Not quite sure that it is related to the original problem, though.

No, that didn’t seem to fix it.

Am I using the correct function?
Should it be updating correctly when saving the event?

Don’t worry, I just fixed it.

It was a problem with me checking if approved was == 0, when it should have been ==“0”