How to refresh grid

6 posts, 1 answers
  1. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 07 Feb 2013 Link to this post

    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
  2. Answer
    Atanu
    Atanu avatar
    40 posts
    Member since:
    Jan 2012

    Posted 07 Feb 2013 Link to this post

    Try
    var grid = $("#MyGrid").data("kendoGrid");
    grid.dataSource.read();
    Hope that helps
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 07 Feb 2013 Link to this post

    bingo, thanks mate
  5. Gabriel
    Gabriel avatar
    8 posts
    Member since:
    Sep 2014

    Posted 21 Nov 2014 Link to this post

    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
  6. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 25 Nov 2014 Link to this post

    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: 
    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.

     
  7. Gabriel
    Gabriel avatar
    8 posts
    Member since:
    Sep 2014

    Posted 25 Nov 2014 in reply to Alexander Popov Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready