Keeping pageSize "All" when datasource refresh gets more records

2 posts, 0 answers
  1. Adam
    Adam avatar
    7 posts
    Member since:
    Mar 2015

    Posted 14 Jun 2017 Link to this post

    We have a grid configured with the "all" page size in the options: 

    this.gridOptions.pageable = <kendo.ui.GridPageable>{
                    input: true,
                    numeric: false,
                    pageSizes: ["all", 5, 10, 20, 50],
                    refresh: true
                };

     

    When we programmatically refresh the grids datasource (below), and that refresh pulls in an additional item to display in the grid, the pager in the grid is no longer what we'd expect. 

    this.manageGridDataSource.read();

     

    If the grid had 9 items before, the pager now shows 9, and the new item is now on page two. I understand that the "all" selection just sets the pageSize to the total number of items in the datasource, but what we want to happen is that after the refresh, the "all" setting is preserved and the additional grid item displays on the first page, not generate a second page of data. 

    Do you know how this can be achieved? 

  2. Stefan
    Admin
    Stefan avatar
    2893 posts

    Posted 16 Jun 2017 Link to this post

    Hello Adam,

    Based on the provided information it seems the pageSize property of the dataSource is set to 9, as otherwise when a new item is added it should stay on the same page:

    http://dojo.telerik.com/unujO

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-pageSize

    In this scenario, I can suggest to either remove the set pageSize or to set it to the number after which the new items should go to the next page.

    If additional assistance is needed, please provide a runnable example, and I will gladly assist.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top