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

Updating resources display

1 Answer 224 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 01 Aug 2013, 11:00 AM
Hello,

I currently have my resources being retrieved from an action on my controller, however I want to be able to refresh the resources according to a filter (too many rooms to display all at once)

Using the code below I am able to update the datasource, but I can't find a way to refresh the scheduler itself to display the new resources.

Is there a way to do this without doing a full page post?
$('#BookingGrid').data().kendoScheduler.resources[0].dataSource.read()

1 Answer, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 01 Aug 2013, 02:16 PM
Found a way to do this:

1. Button fires the read function on the resources data source
$('#room-filter-submit').click(function () {
    $('#BookingGrid').data().kendoScheduler.resources[0].dataSource.read();
});
2. Added handler to Change event on the read action of the Resources data source
.DataSource(source => source
                        .Read(read => read.Action("JsonRooms", "Booking")
                                        .Data("getRoomFilter")
                                        .Type(HttpVerbs.Post)
                        ).Events(e => e.Change("refreshScheduler")))
3. Handler will redraw the Current view
function refreshScheduler() {
    $('#BookingGrid').data().kendoScheduler.view($('#BookingGrid').data().kendoScheduler._selectedViewName);
}

Now can filter the resources and refresh the widget.

Ken.
Tags
Scheduler
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Share this question
or