Updating resources display

2 posts, 0 answers
  1. Ken
    Ken avatar
    2 posts
    Member since:
    May 2013

    Posted 01 Aug 2013 Link to this post

    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()
  2. Ken
    Ken avatar
    2 posts
    Member since:
    May 2013

    Posted 01 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top