Extending AgendaView using Razor part

2 posts, 0 answers
  1. Erik
    Erik avatar
    24 posts
    Member since:
    Sep 2013

    Posted 11 Oct 2013 Link to this post

    Hi,

    I'm creating this new post from http://www.kendoui.com/forums.aspx/kendo-ui-web/scheduler/extending-agenda-view-to-show-whole-month-or-above-.aspx

    Since I'm using the razor part I would like to know how to initialize the widget correctly. I've tried to put it together with the snippets from the above post but I cannot get it to work. Perhaps I'm missing something. Does anyone know how to do this properly?

    This is what I have and it's not working:
    <script type="text/javascript">
     
        var CustomAgenda = kendo.ui.AgendaView.extend({
            endDate: function () {
                var date = kendo.ui.AgendaView.fn.endDate.call(this);
                return kendo.date.addDays(date, 30);
            }
        });
        kendo.ui.Scheduler.fn.options.views = [{ type: "CustomAgenda", title: "My View" }];
     
    </script>
     
    @(Html.Kendo().Scheduler<Gusto.Web.Models.Scheduler.TaskViewModel>()
        .Name("scheduler")

  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 11 Oct 2013 Link to this post

    Hello Erik,

    As I have mentioned in the previous thread setting custom views are not supported by the ASP.NET MVC wrapper.

    However, here is a full declaration of a scheduler widget which uses the custom view in the way described in the thread you have referred to:

    <script type="text/javascript">
     
        var CustomAgenda = kendo.ui.AgendaView.extend({
            endDate: function () {
                var date = kendo.ui.AgendaView.fn.endDate.call(this);
                return kendo.date.addDays(date, 30);
            }
        });
     
        kendo.ui.Scheduler.fn.options.views = [{ type: "CustomAgenda", title: "My View" }];
     
    </script>
     
    @(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
        .Name("scheduler")
        .Date(new DateTime(2013, 6, 13))
        .StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
        .Height(600)
        .Timezone("Etc/UTC")
        .DataSource(d => d
            .Model(m => {
                m.Id(f => f.TaskID);
                m.Field(f => f.OwnerID).DefaultValue(1);
            })
            .Read("Read", "Scheduler")
            .Create("Create", "Scheduler")
            .Destroy("Destroy", "Scheduler")
            .Update("Update", "Scheduler")
        )
    )

    Note that there are no views defined via the wrapper configuration.

    In case it is required to have additional views shown, you will need to configure them via JavaScript similar to the way custom view configuration is defined:

    kendo.ui.Scheduler.fn.options.views = [
        { type: "CustomAgenda", title: "My View" },
        "day",
        { type: "week", selected: true }
    ];



    Regards,
    Rosen
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top