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

Set isAllDay as ressource

5 Answers 42 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 04 May 2017, 03:54 PM

Hello,

I try to color "isAllDay" event.
The simpliest way for me to do somethiong like this:

// Couleur isAllDay
r.Add(m => m.IsAllDay)
.Title("Supprimé")
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.BindTo(new[] {
                new { Text = "Journée", Value = 1 , Color = "red" },
});

 

But it's not working. I also tried Convert.ToBoolean(1), but it the same issues.

Do you have any advice ?

Thank you

5 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 08 May 2017, 01:06 PM
Hello,

One way to achieve similar behavior is to use the dataBound event of the widget and change the color of the allday events as for example it is done here.

Regards,
Plamen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Simon
Top achievements
Rank 1
answered on 28 Feb 2018, 08:07 PM

Hi, reopening an old post here, I tried the sample code for setting the background color of the event on dataBound event but in a recurring event only the first event in the occurrence is set to red background.Each event has a unique id, is this an issue with recurring events? Is there a workaround?

 

    function scheduler_dataBound(e) {
        //Handle the dataBound event.


            var view = this.view();
            var events = this.dataSource.view();
            var eventElement;
            var event;

            for (var idx = 0, length = events.length; idx < length; idx++) {
                event = events[idx];

                //get event element
                eventElement = view.element.find("[data-uid=" + event.uid + "]");

                //if (event.IsPublished) {
                //    eventElement.css("background-color", "green");
                //}
                //else {
                //    //set the backgroud of the element
                //    eventElement.css("background-color", "red");
                //}

                eventElement.css("background-color", "red");

            }

   }

0
Plamen
Telerik team
answered on 02 Mar 2018, 12:36 PM
Hello,

In such case we may use the dataItems instead of the events as for example in this dojo.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Simon
Top achievements
Rank 1
answered on 02 Mar 2018, 07:26 PM
I don't understand your response - this code doesn't change the background of any cell to red.
0
Plamen
Telerik team
answered on 05 Mar 2018, 09:11 AM
Hi,

It seems like I have changed the dojo in the last minute before sending it - please excuse me for that. Here is a runnable dojo that worked correctly at my side

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Julien
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Simon
Top achievements
Rank 1
Share this question
or