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

Reset grid page on document load

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Huw Lloyd
Top achievements
Rank 1
Huw Lloyd asked on 20 Feb 2014, 04:58 AM
Hi,

I have a grid with command buttons on each row, when I click a command button i link to another page use the querystring/Viewbag to remember the page number until I come back to the page with the grid.

When I return to the page with the grid I can see that I am indeed using the correct page number so in document ready function I use:

var grid = $("#grid").data("kendoGrid");
     grid.dataSource.page(@ViewBag.Page);

But it just displays page 1 irrespective of the page I have stored in @ViewBag.Page

Is there some way that I can force the grid or data source to display the page I want it to when the document loads, after that the page will be set from the pager controls on the grid. 

Many thanks in advance

1 Answer, 1 is accepted

Sort by
0
Huw Lloyd
Top achievements
Rank 1
answered on 20 Feb 2014, 05:07 AM
Sorted it - obvious really!!

var gridData = new kendo.data.DataSource({
        serverPaging: true,
        pageSize: 10,
        page:  @ViewBag.Page,
....
Tags
Grid
Asked by
Huw Lloyd
Top achievements
Rank 1
Answers by
Huw Lloyd
Top achievements
Rank 1
Share this question
or