Calling refresh is not refreshing the grid.

14 posts, 0 answers
  1. David
    David avatar
    4 posts
    Member since:
    Dec 2011

    Posted 02 Dec 2011 Link to this post

    I made a simple example here using local data. Notice that the refresh button when clicked puts refreshed called. but refreshing is only output on the initial load. 
    http://jsbin.com/ohumul/3/edit

    $('#refresh').button().click(function(){
        $('body').prepend('refresh called.<br/>');
         
        var grid = $("#grid").data("kendoGrid");
           
          grid.refresh();
           
       
       
      });

  2. Nirmal
    Nirmal avatar
    5 posts
    Member since:
    Nov 2011

    Posted 04 Dec 2011 Link to this post

    Hi,

    I am also facing same problem. 

  3. agv
    agv avatar
    4 posts
    Member since:
    Nov 2011

    Posted 05 Dec 2011 Link to this post

    Try
    grid.sync();

  4. David
    David avatar
    4 posts
    Member since:
    Dec 2011

    Posted 09 Dec 2011 Link to this post

    That still isn't refreshing the grid to the new data.

    $('#refresh').button().click(function(){
      $('body').prepend('refresh called.<br/>');
      var l = gdata.length;
      gdata[l] = {ChainRing: l, MidDriveGear: l, MidDriveOutput: l, RearSprocket: l, GearRatio: l+0.1, Motive: l+0.34, GearInch: l+0.23, Speed: l+0.6 };
      var grid = $("#grid").data("kendoGrid");
         
        grid.sync();
     
    });


    Is this just some issue with using local data?
    http://jsbin.com/ohumul/9/edit

  5. Yvan
    Yvan avatar
    14 posts
    Member since:
    Oct 2011

    Posted 11 Dec 2011 Link to this post

    Hi,

    I'm facing the same issue.

    In emergency I'm using DataTables which is very powerful and works well. Maybe also useful for one of you:
    http://www.datatables.net/

    Does anyone know how use the 'Editing' example with a local javascript array instead of remote crud service?

  6. Yvan
    Yvan avatar
    14 posts
    Member since:
    Oct 2011

    Posted 12 Dec 2011 Link to this post

    Maybe it would help one of you.

    In my case I wasn't updating the data trough the dataSource object. I solved my issue with the following line:

    $("#grid").data("kendoGrid").dataSource.add({/* my object */}));

  7. Piyush
    Piyush avatar
    158 posts
    Member since:
    Nov 2007

    Posted 23 Dec 2011 Link to this post

    read about this in another thread. worked for me. Strange that refresh() does not do this automatically. Also, the sync on dataSource gives error that object does not have such method.

    $(
    "#grid").data("kendoGrid").dataSource.read(); 

  8. Igor
    Igor avatar
    26 posts
    Member since:
    Nov 2010

    Posted 29 Dec 2011 Link to this post

    Hi,

    I'm facing the same issue using the first release of KendoUi.
    Let assume : 
    var grid = $("#grid").data("kendoGrid");
    var new_data = createRandomData(50); 

    So I have tried things like:
    grid.dataSource.add(new_data);
    or 
    grid.sync(); 
    but they are unsupported methods (old versions?).

    What it works for me is:
    grid.dataSource .data(  new_data );
    grid.refresh(); 

    To be sure that data are changed, you can check the data source view:
     JSON.stringify(grid.dataSource.view())

  9. Igor
    Igor avatar
    140 posts
    Member since:
    Jan 2011

    Posted 16 May 2012 Link to this post

    hi!
    seems like this issue is still present
    do you have any update on fixing it?

  10. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8289 posts
    Member since:
    Dec 2014

    Posted 16 May 2012 Link to this post

    Hello,

     The refresh method repaints the grid using the current data source data. To refresh the data source use its read method:

    grid.dataSource.read();

    Regards,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!

  11. Igor
    Igor avatar
    140 posts
    Member since:
    Jan 2011

    Posted 16 May 2012 Link to this post

    Thanks for quick reply, Atanas!
    I will try your solution shortly

  12. Princess
    Princess avatar
    11 posts
    Member since:
    Feb 2012

    Posted 04 Dec 2012 Link to this post

    I tried  $("#FileDetailsCreate").data("kendoGrid").dataSource.read(); but on the firebug the error is 
     

  13. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8289 posts
    Member since:
    Dec 2014

    Posted 05 Dec 2012 Link to this post

    Hello,

     This means that the grid is not yet initialized when this code is invoked or that the selector is wrong. 

    Regards,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!

  14. Princess
    Princess avatar
    11 posts
    Member since:
    Feb 2012

    Posted 05 Dec 2012 Link to this post

    Yes, I just mix up the name of my grid. Anyway, thank you!

Back to Top