Posted 05 Nov 2012
Link to this post
I am using the Kendo Grid with a custom sort criteria component, and also storing the grid state so as to return the grid to the state it was in when the page is reloaded at a later stage. In so doing, I need to set the grid to a specific page, and pass additional values to the read action.
I do not know how to set the page number along with the additional data in one call, so I am setting the grid page and calling read on the dataSource to achieve what I want. Naturally, I would prefer to do this in one call.
So, what I want to know is:
Can you set the page on the grid without triggering a dataSource read?
I read about the autoSync property, and thought I could temporarily set it to false (while setting the page number), but the property does not seem to be there. Was it deprecated?
So, the only issue I have left is how to get back data and jump to a specific page in one step (without resulting in two calls to the read action).
Sorry, I typed this in the early hours of the morning and was not very coherent. What I am looking to do can be distilled to the following:
Is it possible to, on the initial load (page loading for the first time with a Kendo Grid), set the grid to start on a specific page (other than page 1)?
What I have done is to add a hidden element to the page with the page number I want to set the grid to as the value. Then, by binding to the databound event, I can check this value and, if it is required (if it is greater than 1), set the grid's page number to this value, which then triggers the read. This works, but it means two calls to the read action (the initial one, and the one for the page jump). I tried switching off the autoBind, but it still requires two calls to get the grid set. It seems that calling the read action with a page number greater than the current page set causes it to be ignored and revert to page 1. So, one has to load page 1, then jump to the page you want.
Is there any way to set the grid's initial page number, so as to avoid the double data read?