Set Scheduler Title Date Range to Curent Week and Agenda View to Default

4 posts, 0 answers
  1. Anieda Hom
    Anieda Hom avatar
    21 posts
    Member since:
    Mar 2009

    Posted 07 Aug 2018 Link to this post

    Hello Telerik Team,

     

    How can I set scheduler title date range to the current week (dynamic)?  How to set the Agenda view to default view whenever the calendar load?  How to make the text with all day schedule to hyper link (however, this text is linkable in agenda view)? 

     

    This is the code:

    @(Html.Kendo().Scheduler<HomeTaskViewModel>()
                    .Name("scheduler")
                    .Date(new DateTime(2018, 5, 7))
                    .StartTime(new DateTime(2018, 5, 7, 0, 00, 00))
                    .EndTime(new DateTime(2018, 5, 7, 23, 59, 59))
                    .Editable(false)
                    .Height(600)
                    .EventTemplate(
                        "<div class='task-template'>" +
                        //"#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
                        //"<br />" +
                        //"<a href='#= Url #'>#= description #</a>" +
                        "<a href='" + @Url.Action("Read","Request") + "/" + "#= RequestId #'>#= description #</a>" +
                        "</div>")
                    .Views(views =>
                    {
                        views.DayView();
                        views.WorkWeekView(workWeekView => workWeekView.Selected(true));
                        views.WeekView();
                        views.MonthView();
                        views.AgendaView();
                        //views.TimelineView();
                    })
                    .Resources(resource =>
                    {
                        resource.Add(m => m.GroupId)
                          .Title("Owner")
                          .DataTextField("Text")
                          .DataValueField("Value")
                          .DataColorField("Color")
                          .BindTo(Model.Select(x => new {Text = x.GroupName, Value = x.GroupId, Color = x.Color}));
                    })
                    //.BindTo(Model)
                    .DataSource(d => d
                               .Model(m => {
                                   m.Id(f => f.RequestId);
                                   m.Field(f => f.Description).DefaultValue("No title");
                                   m.Field(f => f.GroupId).DefaultValue(1);
                                   m.Field(f => f.Title).DefaultValue("No title");
                                   m.RecurrenceId(f => f.RecurrenceID);
                               })
                               .Read("ReadRequests", "Home", "Scheduler")
                          )
                    )
    <script type="text/javascript">
        $(function () {
            $(".GroupNames :checkbox").change(function (e) {
                var checked = $.map($(".GroupNames :checked"), function (checkbox) {
                    return parseInt($(checkbox).val());
                });
                var filter = {
                    logic: "or",
                    filters: $.map(checked, function (value) {
                        return {
                            operator: "eq",
                            field: "GroupId",
                            value: value
                        };
                    })
                };
                var scheduler = $("#scheduler").data("kendoScheduler");
                scheduler.dataSource.filter(filter);
            });
        })
    </script>

    Thank you very much in advanced for your help!

    Anieda

  2. Anieda Hom
    Anieda Hom avatar
    21 posts
    Member since:
    Mar 2009

    Posted 07 Aug 2018 in reply to Anieda Hom Link to this post

    I can set the agenda view to default now.  But I still need your help on how to display the current week when calendar loads.  And make the all day schedule text linkable.

    Many thanks,

    Anieda

     

  3. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1235 posts

    Posted 09 Aug 2018 Link to this post

    Hi Anieda,

    In order to display the current week in the Scheduler initially, you will need to set the current day as a parameter of the Data() configuration method. Concerning the other question, similarly to the EventTemplate, you could define an AllDayEventTemplate. That would allow you to include links in the events, placed on the AllDay slots:
    @(Html.Kendo().Scheduler<CustomEditButton.Models.AppointmentSummaryModel>()
        .Name("scheduler")
        .Date(DateTime.Today)
        .AllDayEventTemplate("<a href='" + @Url.Action("Read", "Request") + "/" + "#= Id #'>#= title #</a>")
        .EventTemplate("<a href='" + @Url.Action("Read", "Request") + "/" + "#= Id #'>#= title #</a>")
    ..

    Regards,
    Veselin Tsvetanov
    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.
  4. Anieda Hom
    Anieda Hom avatar
    21 posts
    Member since:
    Mar 2009

    Posted 09 Aug 2018 in reply to Veselin Tsvetanov Link to this post

    Good afternoon Veselin,

    Thank you so much for your response.  The code works well!!

    Thanks again!
    Anieda

Back to Top