How do I prevent a grid update when the datasource is dirty?

2 posts, 0 answers
  1. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 04 Mar 2015 Link to this post

    We have an editable grid with batch mode set to true. The grid has paging and sorting enabled. The grid uses an Ajax datasource with Serverside mode true.

    I would like to prevent the user from paging/sorting while there are changes on that page.

    I see that I am able to check the datasource.hasChanges().

    I tried to do this in the startRequest event but of course, that also fires before a savechanges() and I see no way to differntiate since there is no indication of the action causing the request.

    Any suggestions or samples on how I can accomplish this?
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 09 Mar 2015 Link to this post

    Hello Bob,

    First of all let me apologize for the late reply.

    The DataSource do not have page or sort events. You may check if the sort object or page number has changed at the requestStart event.
    The sort object may be retrieved using the sort method of the dataSource and the page - using the page method of the dataSouce.

    function requestStart(e) {
      if (e.type === "read") {
        var sort = this.sort();
        var page = this.page();
        //compare sort to old sort
        //compare page to old page
      }
    }


    You may save the current page and sort state at the change event handler of the DataSource which fires after sorting/paging is applied.

    I hope this information will help.

    Regards,
    Alexander Valchev
    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