Update Grid PageSize not working in ClientSide Paging Grid

4 posts, 0 answers
  1. PrimePay
    PrimePay avatar
    25 posts
    Member since:
    Feb 2015

    Posted 31 Mar 2015 Link to this post

    I am working on a Client-Side paging grid (ServerOperation(false)) where I need to manually update the page size when a new row has been added using the grid's dataSource.insert() method. The reason for this is because I want to have the new record visible as well as any other existing records on the grid on the same page.

    I am updating the page size using the following code when a new record is added:

    var grid = $("#myGrid").data("kendoGrid");
    var currentPageSize = grid.dataSource.pageSize();
    grid.dataSource.pageSize(++currentPageSize);
    grid.refresh();

    Unfortunately, the above code does not work for Client-Side paging but it works on Server-side paging.

    Any assistance would be very welcome.
  2. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 02 Apr 2015 Link to this post

    Hello,

    The code looks correct. Calling refresh is not needed but this should not cause a problem. Could you check this example and let me know if I a missing something?

    Regards,
    Daniel
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. PrimePay
    PrimePay avatar
    25 posts
    Member since:
    Feb 2015

    Posted 07 Apr 2015 Link to this post

    Thanks Daniel,

     I was doing everything according to the example you provided, the only difference being that I have a button to show and hide rows (on defined conditions), so while I could have 10 rows in the grid, only 6 might be visible. Client-Side paging did not seen to update the dataSource page size.

    The only way to fix this was to use server-side paging.

  4. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 09 Apr 2015 Link to this post

    Hi again,

    If some of the rows should not be visible then I you could filter the dataSource. The page size should be correct in this case. I updated the example to demonstrate this case.

    Regards,
    Daniel
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top