Reload resources

3 posts, 0 answers
  1. Chad
    Chad avatar
    13 posts
    Member since:
    Aug 2012

    Posted 23 Jul 2015 Link to this post

    I have a number of options on the page for users to choose which resources they want to load on the scheduler. On scheduler load I make a call to load the resources that they have previously save but I'm not able to manipulate or change them once the page loads. Here is my configuration. 

    @(Html.Kendo().Scheduler<Avianis.Models.Scheduler.AppointmentViewModel>()
            .Name("scheduler")
            .Date(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day))
            .AutoBind(false)
            .Snap(true)
            .Timezone("UTC")
            .Events(e =>
            {
                e.Navigate("scheduler_navigate");
            })
            .Views(views =>
            {   
                views.TimelineView(timeline => timeline
                    .Title("Day")
                    .MajorTick(60)
                    .MinorTickCount(1)
                    .EventHeight(77)
                    .ColumnWidth(150)
                    .EventTemplateId("more-template")
                );
                views.CustomView("TimelineViewFiveDays");
                views.CustomView("TimelineViewSevenDays");
                views.CustomView("TimelineViewThirtyDays");
                views.MonthView(timeline => timeline
                    .EventHeight(40)
                );
            })
            .EventTemplateId("event-template")
            .Group(group => group.Resources("Aircraft").Orientation(SchedulerGroupOrientation.Vertical))
            .Resources(resource => resource.Add(m => m.ResourceID)
                .Name("Aircraft")
                .Title("Aircraft")            
                .DataValueField("id")
                .DataTextField("text")
                .DataSource(source => source.Read("GetResources", "Calendar"))
            )
            .Editable(editable => editable
                .Update(false)
                .Create(false)
                .Destroy(false)
                .Move(false)
                .Resize(false)
            )
            .DataSource(dataSource => dataSource            
                .SignalR()
                .Transport(tr => tr                
                    .Promise("hubStart")
                    .Hub("calendarHub")
                    .Server(s => s
                        .Read("LoadAircraft"))
                )
                .Schema(schema => schema
                    .Model(model =>
                    {
                        model.Id(m => m.ID);
                        model.Field(m => m.ID).Editable(false);
                        model.Field("start", typeof(DateTime)).From("Start");
                        model.Field("end", typeof(DateTime)).From("End");
                        model.Field("title", typeof(string)).From("Subject");
                        model.Field("description", typeof(string)).From("Description");
                        model.Field("isAllDay", typeof(bool)).From("IsAllDay");
                        model.Field("ownerId", typeof(string)).From("OwnerId");
                    })
                )
            )
        )

     

    I've trying to change resources by saving the selected resources to the database then calling the line below. 

    $('#scheduler').data().kendoScheduler.resources[0].dataSource.read();

     

    And I've tried it this way as well. 

    var scheduler = $("#scheduler").data("kendoScheduler");
    scheduler.resources[0].dataSource.data(data);
    scheduler.view(scheduler.view().name);

     

    Both ways do not refresh the UI. Any help would be appreciated. 

     

     

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 28 Jul 2015 Link to this post

    Hello Chad,

    In general, the right way to reload/update the resources is to read the data source, like you mentioned in your message:
    scheduler.resources[0].dataSource.read()

    Here is a Dojo demo that shows how the resource is updated on every dataSource.read():


    Would it be possible to modify the demo in order to demonstrate the erroneous behavior.

    Regards, Georgi Krustev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Yoichi
    Yoichi avatar
    1 posts
    Member since:
    Oct 2015

    Posted 18 Jul in reply to Chad Link to this post

    Hello,

    Have you solved it ?

    var scheduler = $("#scheduler").data("kendoScheduler");
    scheduler.resources[0].dataSource.read().then(
        function () {
            scheduler.view(scheduler.view().name);
        });

Back to Top