Extending AgendaView using Razor part

Thread is closed for posting
5 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
    3247 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. Lee
    Lee avatar
    2 posts
    Member since:
    Aug 2015

    Posted 08 Mar in reply to Rosen Link to this post

    Thank you, Rosen. This helped me a lot.
  4. Nandakumar
    Nandakumar avatar
    2 posts
    Member since:
    Nov 2015

    Posted 21 Mar Link to this post

    Hi Rosen,

    We have a similar implementation used in our Project, but after the kendo upgrade 2017-R1. I notice with the Kendo.all.min.js, these events seems to be not firing..and only the MVC-Razors ones are working.

    Any headups will be of great help!!

     

    Thanks,

    Nanda

  5. Rosen
    Admin
    Rosen avatar
    3247 posts

    Posted 23 Mar Link to this post

    Hello Nanda,

    It seems that it is working as expected on our end. Therefore, please open a separate support request in which to provide as much information about your scenario as possible. Also a small runnable sample demonstrating the issue you are facing will be appreciated.

    Regards,
    Rosen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top