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

Scheduler event color doesn't show with datasource autobind set to false

8 Answers 249 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 23 Sep 2020, 11:49 AM

Hello,

Scheduler event color doesn't show with datasource autobind set to false

Datasource of the scheduler is being read after dropdownlist is loaded  ...

        var scheduler = $("#scheduler").data("kendoScheduler");
        scheduler.dataSource.read();

 

Once the editor was open and closed, the color of the events will be shown, see attachment.

 

8 Answers, 1 is accepted

Sort by
0
K.Ramadan
Top achievements
Rank 2
Veteran
answered on 23 Sep 2020, 12:07 PM

hello Oliver,

can you please show the scheduler widget !

maybe i can reproduce the problem on my side, and then help you.

0
Oliver
Top achievements
Rank 1
answered on 23 Sep 2020, 12:50 PM

Hello blackout,

here the scheduler widget ...

 

@(Html.Kendo().Scheduler<MSE1.Areas.Scheduler.ViewModels.Scheduler_ViewModel>()
        .Name("scheduler").Timezone("Etc/UTC").Height(680).MajorTick(120)
            .Date(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day))
            .StartTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 00, 00, 00))
            .AllDaySlot(false)
            .Editable(editable =>
            {
                editable.TemplateName("Scheduler");
                editable.Resize(false); editable.Update(false); editable.Move(false);
            })
            .Height(600).HtmlAttributes(new { @class = "small" })
            .Views(views =>
            {
                views.DayView();
                views.WeekView(view => view.Selected(true));
                views.MonthView();
                views.AgendaView();
                views.TimelineView();
            })
                .EventTemplate("# if (Active == true) { # <div style=\"width: 100%; height: 100%;\" title=\"(#= kendo.toString(start, \"HH:mm\") # - #= kendo.toString(end, \"HH:mm\") #) #=title# #=RecurrenceInfo#\"><p style=\"padding: 5px;\">#=kendo.toString(start, \"HH:mm\")# - #=kendo.toString(end, \"HH:mm\")# \\# #=RecurrenceInfo# \\# #=title# \\# #=UserName#</p></div> # } else { # <div style=\"width: 100%; height: 100%;\" class=\"stripes\" title=\"#= title #\"><p style=\"padding: 5px;\">#= title #</p></div> # } #")

                .Resources(resource =>
                {
                    resource.Add(m => m.CategoryId).Title("Event").DataTextField("Text").DataValueField("Value").DataColorField("Color")
                    .BindTo(scheduler_categories);
                })
                .DataSource(d => d
                .Model(m => {
                    m.Id(f => f.Id);
                    m.Field(f => f.Title).DefaultValue("No title");
                    m.Field(f => f.CategoryId).DefaultValue(1);
                    m.Field(f => f.Active).DefaultValue(true);
                    m.RecurrenceId(f => f.RecurrenceId);
                })
                    .Read(read => read.Action("Scheduler_Read", "Scheduler", new { area = "Scheduler" }).Data("fn_scheduler_data"))
                    )
                .AutoBind(false)
    )


0
K.Ramadan
Top achievements
Rank 2
Veteran
answered on 23 Sep 2020, 01:17 PM

Hello Oliver,

from what i can understand from this PAGE that if you set the autobind to false, it will not bind (it will not get the colors) until a Change event is fired .. so maybe try to set to true !

0
K.Ramadan
Top achievements
Rank 2
Veteran
answered on 23 Sep 2020, 01:26 PM

this is the PAGE : https://docs.telerik.com/kendo-ui/api/javascript/ui/scheduler/configuration/autobind

there you will find your answer.

 

in my previous post I meant Change Event of the dataSource. That will also apply for dataSources for the resources used in the widget.

and the Change Event of the dataSource is being fired on this line :

scheduler.dataSource.read();

0
Oliver
Top achievements
Rank 1
answered on 23 Sep 2020, 01:49 PM

Thanks for the hint!

Didn't know that this will also affect the resources dataSource.

0
Neli
Telerik team
answered on 25 Sep 2020, 08:18 AM

Hello,

Indeed, as it is written in the Scheduler API documentation when the autobind is set to false, the configuration will be applied also to the resources.

I would also suggest you try to refresh the Scheduler by using the refresh() method and check if it resolves the issue.

I hope this helps.

Regards,
Neli
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Oliver
Top achievements
Rank 1
answered on 25 Sep 2020, 09:48 AM

Hello Neli,

i've set autobind to true for the scheduler and added an optional label to my dropdownlist.

So on page load the dropdownlist value is empty and shows an empty scheduler.

I think thats OK for now ...

Thank you for your help!

0
Neli
Telerik team
answered on 29 Sep 2020, 07:01 AM

Hello Oliver,

Thank you for the feedback and for sharing the steps that helped you to resolve the issue. We always appreciate any feedback as it could be helpful for someone else in the future who has a similar scenario.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Scheduler
Asked by
Oliver
Top achievements
Rank 1
Answers by
K.Ramadan
Top achievements
Rank 2
Veteran
Oliver
Top achievements
Rank 1
Neli
Telerik team
Share this question
or