Reputation: 117
Hi i'm very much new to kendo UI, so need help in the below fix,
I'm using kendo grid UI as below for pagination:
<script>
$(document).ready(function(){
$("#table3").kendoGrid({
dataSource: {
pageSize: 10
},
pageable: true,
enter code here
height: 300,
sortable: true,
});
$("#table3").show();
});
</script>
when user edits a record in a page, he's redirected to edit page with that record details so I need current page number because after editing a record in a page, I need to redirect user to the same page after saving the details of that record. I'm using this in a coldfusion page. Please help.
Thanks in advance
Upvotes: 6
Views: 13764
Reputation: 31
// declare page index as 1
var currentPage = 1;
pageable: {
change: function (e) {
currentPage = e.index;
},
page: currentPage,
sortable: true,
..`enter code here`
}
$scope.grid = dataSource;
$scope.grid._page = currentPage;// stay in the current page after grid refreshes
Upvotes: 3
Reputation: 2560
What you are after is here :
http://docs.kendoui.com/api/web/pager#methods-page
// get the page
var currentPage = grid.dataSource.page();
// later set the page
grid.dataSource.page(currentPage );
But I am bit confused with the redirect from the grid to edit page, why do you do that ? Kendo has inline batch edit and popup edit features, if you move to other page it will all get bit more complicated.
FYI : http://demos.kendoui.com/web/grid/editing.html
Upvotes: 8