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

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

3 Answers 248 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anieda Hom
Top achievements
Rank 1
Anieda Hom asked on 07 Aug 2018, 08:43 PM

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

3 Answers, 1 is accepted

Sort by
0
Anieda Hom
Top achievements
Rank 1
answered on 07 Aug 2018, 08:56 PM

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

 

0
Veselin Tsvetanov
Telerik team
answered on 09 Aug 2018, 02:53 PM
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.
0
Anieda Hom
Top achievements
Rank 1
answered on 09 Aug 2018, 05:43 PM

Good afternoon Veselin,

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

Thanks again!
Anieda

Tags
Scheduler
Asked by
Anieda Hom
Top achievements
Rank 1
Answers by
Anieda Hom
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or