kingkelly
kingkelly

Reputation: 199

If more than 2 events, change cell color

Im currently using eventRender to change the background color of an event's cell (month view), but I'm hoping to take it further and change the cell to another color if theres 2 or more events on that date.

Something like:

eventRender: function(event, element, view)

 if >2 events 
    {element.css("background-color", "orange"); }
 else
    { element.css("background-color", "red");}

Upvotes: 0

Views: 165

Answers (1)

hazan kazim
hazan kazim

Reputation: 958

Try this one to change the back ground colour as per the different event

eventRender: function(event, element, view) {
            if (event.title == 'Birthday) {
                element.css('background-color', 'red');
            }
            else if (event.title == 'Interview) {
                element.css('background-color', 'green');
            }
            else if (event.title == 'Anniversary') {
                element.css('background-color', 'Yellow');

            }
        },

or otherwise you can do this with in event object by add the colour.

events:[{
                title: 'Birthday',
                start: new Date(y, m, d + 1, 19, 0),
                end: new Date(y, m, d + 1, 22, 30),
               // backgroundColor: App.getBrandColor('purple'),
                 color:'#4fc6d2'
                allDay: false
            }]

Upvotes: 1

Related Questions