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

AllDayEventTemplateId for different views

3 Answers 97 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Becky
Top achievements
Rank 1
Becky asked on 29 Oct 2014, 02:57 PM
Hi,

I would like to show a different template for the day and the week view of my scheduler. This works correctly when setting the 'AddDayEventTemplate' on the view. However when I change this to use 'AddDayEventTemplateId' (and reference the appropriate script tag) it doesn't show the template and just shows the default event template.

My code is:

<script id="day" type="text/x-kendo-template">
    <p>Day event #=title#</p>
</script>
 
 
<script id="week" type="text/x-kendo-template">
   <p>Week event #=title#</p>
</script>
 
 
@(Html.Kendo().Scheduler<SurveyPortal.Web.ViewModels.ScheduleViewModel>()
    .Name("adminScheduler")
    .Editable(e=>e.Destroy(false).Resize(false))
    .Views(v=>{
        v.DayView(m => m.ShowWorkHours(true).AllDayEventTemplateId("day"));
        v.WeekView(m => m.ShowWorkHours(true).AllDayEventTemplateId("week"));
        v.MonthView(m => m.Selected(true));
    })
    .Resources(r=>{
        r.Add(m => m.ItemType)
            .Title("ItemType")
            .DataValueField("ItemType")
            .DataTextField("Text")
            .ValuePrimitive(false)
            .BindTo(new[] {
                new {Text = "Survey", Value = Model.ScheduleItems},
                new {Text = "Request", Value = Model.ScheduleItems }
            });
    })
    .WorkDayStart(9, 0, 0)
    .WorkDayEnd(18, 0, 0)
    .DateHeaderTemplate("#=kendo.toString(date,'ddd dd/MM')#")
    .MajorTimeHeaderTemplate("#=kendo.toString(date, 'H:mm' )#")
    .BindTo(Model.ScheduleItems)
    .HtmlAttributes(new { @class = "crm_scheduler" })
)

If someone could let me know how to resolve that, it would be much appreciated.

Becky

3 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 31 Oct 2014, 02:14 PM
Hello Becky,

I managed to reproduce this issue and I forwarded it to our development team for further analysis. Meanwhile you can a global AllDay event template that displays different information depending on the Scheduler's active view. For example: 
<script id="allDayTemplate" type="text/x-kendo-template">
    #if($('\\#scheduler').getKendoScheduler().view().name == "day"){#
        <p>Day event #=title#</p>
    #}else{#
        <p>Week event #=title#</p>
    #}#
</script>
  
@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
    .Name("scheduler")
    .AllDayEventTemplateId("allDayTemplate")


Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Becky
Top achievements
Rank 1
answered on 03 Nov 2014, 09:21 AM
Thanks for passing this issue on Alexander.

I have just implemented your suggestion and it works perfectly. Thanks.
0
Alexander Popov
Telerik team
answered on 26 Nov 2014, 03:14 PM
Hi Becky,

I just wanted to let you know that this issue is resolved in Kendo UI Q3 2014 (2014.3.1119).

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Becky
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Becky
Top achievements
Rank 1
Share this question
or