Alan Mosley
Top achievements
Rank 1
Alan Mosley
asked on 08 Feb 2013, 02:59 AM
I have a grid that's I want to refresh, with the old telerik mvc controls we could use ajaxrequest, but that does not seem to work with kendo grid.
How do I refresh the grid without having to reload the page?
Thanks
How do I refresh the grid without having to reload the page?
Thanks
5 Answers, 1 is accepted
1
Accepted
Atanu
Top achievements
Rank 1
answered on 08 Feb 2013, 04:20 AM
Try
Hope that helps
var
grid = $(
"#MyGrid"
).data(
"kendoGrid"
);
grid.dataSource.read();
0
Alan Mosley
Top achievements
Rank 1
answered on 08 Feb 2013, 04:42 AM
bingo, thanks mate
0
Gabriel
Top achievements
Rank 1
answered on 21 Nov 2014, 07:55 PM
When I do this, my paging remains as to how it was with the previous set of data. How do I make the paging refresh with the new set of data.
Ex. initial set. 2 pages. showing 1 - 10 of 12.
I filter to a new set which has 5 rows. But still have 2 page buttons and see 1 - 10 of 12.
Any ideas would be much appreciated.
Thanks!
Gabriel
Ex. initial set. 2 pages. showing 1 - 10 of 12.
I filter to a new set which has 5 rows. But still have 2 page buttons and see 1 - 10 of 12.
Any ideas would be much appreciated.
Thanks!
Gabriel
0
Hello Gabriel,
It looks like the DataSource's total is not properly updated. In case the ASP.NET MVC wrappers used, the total should be present in the request's response and you wouldn't have to worry about it. For example:
The DataSource could also be configured to get the schema.total from another field or to use a JavaScript function to calculate it. I am not sure what is causing the issue in your case, so I would ask you to share the related client and server-side code, so we can investigate further.
Regards,
Alexander Popov
Telerik
It looks like the DataSource's total is not properly updated. In case the ASP.NET MVC wrappers used, the total should be present in the request's response and you wouldn't have to worry about it. For example:
AggregateResults:
null
Data: [{ProductID:21, ProductName:Sir Rodney's Scones, UnitPrice:10, UnitsInStock:3, Discontinued:
false
,…},…]
Errors:
null
Total: 77
The DataSource could also be configured to get the schema.total from another field or to use a JavaScript function to calculate it. I am not sure what is causing the issue in your case, so I would ask you to share the related client and server-side code, so we can investigate further.
Regards,
Alexander Popov
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.
0
Gabriel
Top achievements
Rank 1
answered on 25 Nov 2014, 03:54 PM
Hi Alexander,
Thanks for the answer!! I was able to resolve the issue by adjusting the way my grid was working. I was previously making an AJAX call to my controller, retrieving a dataset, then on success attempting to bind a new datasource object to the grid from the returned data set.
I now am making my ajax call to the controller, get my set of data, then calling the grid's read action to read that dataset, passing it as parameter back to the controller and returning a JSON result. This has resolved my paging issues as well as an issue I was having with the grid's read call resolving before the controller had finished loading and returned the data (giving me a null result/blank grid).
Thanks again for your suggestions and help!
Regards!
Gabriel
Thanks for the answer!! I was able to resolve the issue by adjusting the way my grid was working. I was previously making an AJAX call to my controller, retrieving a dataset, then on success attempting to bind a new datasource object to the grid from the returned data set.
I now am making my ajax call to the controller, get my set of data, then calling the grid's read action to read that dataset, passing it as parameter back to the controller and returning a JSON result. This has resolved my paging issues as well as an issue I was having with the grid's read call resolving before the controller had finished loading and returned the data (giving me a null result/blank grid).
Thanks again for your suggestions and help!
Regards!
Gabriel