- Home
- Forum
- ASP.NET MVC
- Update grid datasource without going back to page 1
Update grid datasource without going back to page 1
I have a Grid (defined using MVC helpers) which displays some data that is periodically updated from a ajax call.
Thanks for using Syncfusion products.
We have analyzed your requirement and we can get the current page index details using “currentPage” property of the pageSettings of the grid as follows.
|
<script type="text/javascript"> //Creating instance for grid var gridObj = this.bufferGridEl.data("ejGrid"); //Getting current page number value using pageSettings property before updating the datasource var currentPage = gridObj.pageSettings.currentPage; $.getJSON("/Tracking/GetTrackingBufferByZone", obj2Send, //Set the current page number through set model |
Please refer the below documentation link for more clarification.
http://help.syncfusion.com/UG/JS_CR/ejGrid.html#pageSettings
We can also set the page number using the method “gotoPage” and also please refer the below link for more clarification.
http://help.syncfusion.com/UG/JS_CR/ejGrid.html#gotoPage
If we misunderstood your requirement please provide more details about your requirement like screenshot or in which event/scenario you are updating the data source. The provided information will help us to analyze the issue and provide you the response as early as possible.
Regards,
Gowthami V.
thank you for your greate answer.
The code looks straight-forward, I should have looked in the docs by myself.
Sorry about the inconvenience caused.
Query 1: But I have an issue with your code:
We have mistakenly updated the code snippet for getting currentPage directly from the grid instance instead of from the grid’s model.
Now we are happy that you have found the correct code and resolved the issue.
Please get back to us if you need further assistance. We will happy to assist you.
Query 2: setting datasource and pagesettings at the same time won't work: the page wil be resetted to 0
We have analyzed your issue and we are unable to reproduce the reported issue “setting datasource and pagesettings at the same time won't work”.
Please share us below details for reproducing the reported issue.
1. Share us the product version details.
2. And share us the code snippet that you have tried in your application.
The provided information will help us to analyze the issue and provide you the response as early as possible.
Regards,
Gowthami V.
- 3 Replies
- 2 Participants
-
AP Antonio Pretto
- Jun 30, 2015 06:44 AM UTC
- Jul 3, 2015 12:32 PM UTC