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

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

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 04 Mar 2015, 03:27 PM
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?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 09 Mar 2015, 08:20 AM
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!
 
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or