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

confirm page change on kendo grid

1 Answer 363 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Logan
Top achievements
Rank 1
Veteran
Logan asked on 24 Jul 2014, 03:44 PM
I am allowing my users to select rows in a kendo grid via a checkbox in the first column and right now the selections are lost if/when they change pages.  I was hoping there would be a way i could show a confirm dialog when when they click the page, but before the page changes and either
1) allow them to perform an action on the selected rows
2) lose the selections
3) stop the page change from occurring

I am having trouble actually stopping the page change from happening.  Are there any samples on how to do this?

Thanks,
-Logan

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 25 Jul 2014, 08:20 AM
Hello Logan,


You could use the requestStart event of the dataSource to detect the page change.
E.g.
.DataSource(dataSource => dataSource
   .Ajax()
   .Events(e => e.RequestStart("requestStart"))
var prevPage = 1;
 
function requestStart(e) {
    if (this.page() !== prevPage) {
        //paging is performed
        if (<custom condition to prevent the paging>) {
            e.preventDefault();
        } else {
            //perform paging and store the current page number
            prevPage = this.page();
        }
    }
}

I hope this information helps. Have a great day!

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Logan
Top achievements
Rank 1
Veteran
Answers by
Dimiter Madjarov
Telerik team
Share this question
or