I am using document.styleSheets[0].addRule(rule, rule_text) in onEventLoading method for coloring events. It throws java script error “Invalid Argument”. I googled and came to know from microsoft web site that it can only add rule upto 4095 beyond that it will throw error.
How to overcome this error. I have more than 10,000 events to apply color. help me with this.
You need to define css rules once per color, and you need not separate css rules for each event.
Just define a list of css rules ( you can do it statically, in separate css file ) and use template to map such css rules to events.
First of all thank you very much for your reply.I am just following the example event coloring from customization package in dhtmlxschduler.I did not get you. In my application i am getting colorcode for each event from database. So, can you please provide me piece of code to define a list of css rules?
scheduler.templates.event_class=function(start,end,event){
return "event_"+(event.color||'default');
};
The point here is to have limited, predefined set of CSS classes and to use them with all events (not to create class for each event).
Thanks for the reply. Yes i have to color each event with the color specified by the user. The user may specify any color when he creates event and i will store the color in the database. When user views the created event, i have to color the event with the same color specified by him during creation.