AllDayEventTemplateId for different views

4 posts, 1 answers
  1. Becky
    Becky avatar
    3 posts
    Member since:
    May 2012

    Posted 29 Oct 2014 Link to this post

    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
  2. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 31 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Becky
    Becky avatar
    3 posts
    Member since:
    May 2012

    Posted 03 Nov 2014 in reply to Alexander Popov Link to this post

    Thanks for passing this issue on Alexander.

    I have just implemented your suggestion and it works perfectly. Thanks.
  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 26 Nov 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready