This is a migrated thread and some comments may be shown as answers.

set color of event

5 Answers 440 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 14 Jul 2019, 12:46 PM

Hello,

 

When viewing events in the scheduler, 

I want new events to be red. (view model status is pending)

later , when I set the status to "approved" , i want the event to appear as green. 

Any suggestions ?

Thanks,Peter

 

5 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 16 Jul 2019, 02:45 PM

hi , Any tips?

Thanks,Peter

0
Dimitar
Telerik team
answered on 17 Jul 2019, 02:01 PM
Hi Peter,

Events background color may be set on Scheduler's databound event shown in Modify Event Styling on databound How To article.
Another approach to change event's background color again using databound event is to set a custom css class, as suggested in the following StackOverflow thread.
If only certain events' background color have to be changed, they may be targeted with custom logic in the event handler. As UI for ASP.NET Core Scheduler is a server-side wrapper of Kendo UI Scheduler, both approaches are applicable to it as well.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 17 Jul 2019, 09:00 PM

Ditmar,

i have 2 follow up questions.

Since my scheduler has 2 resources,  which resource sets  the color of the new event ?

Secondly, how can I later change the color of an event later server side?

Thanks ,Peter

0
Peter
Top achievements
Rank 1
answered on 17 Jul 2019, 09:10 PM
Ditmar : I am interested in what you meant by "they may be targeted with custom logic in the event handler" Any examples ? Thanks,Peter
0
Dimitar
Telerik team
answered on 19 Jul 2019, 01:11 PM
Hello Peter,

The background color of the new event will be the color set to the resource, which is assigned to that event.

As far as changing Scheduler resources on the server and updating them in the Scheduler, the following forum thread summarizes and explains multiple issues related to such scenarios. My colleague Dimitar provides a resolution and an MVC project. Using the same logic I created an ASP.NET Core sample project showing how to change resources colors. It is attached to this reply. Run Index page and click Reload Resources button to change events resources colors - screenshot.

And by custom logic in the event handler to target just particular events I meant the StackOverflow thread code snippet, where there is a check about event's description:

dataBound: function(e) {
    $('div.k-event').removeClass('special-event');
    e.sender._data.forEach(function(eventDetails) {           
        if (eventDetails['description'] === 'special event') {
            $('div.k-event[data-uid="'+eventDetails['uid']+'"]').addClass('special-event');
        }
    });
}

In this case adding class special-event only to events, whose description says special event.

Best regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

Tags
Scheduler
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or