How to change pageSize using setOptions with pageable enabled

5 posts, 0 answers
  1. Dani
    Dani avatar
    55 posts
    Member since:
    Jan 2009

    Posted 04 Dec 2015 Link to this post

    Hi everyone, I searched for a long time for that issue, and that's why I am telling the solutions to everyone.

    We need to enable and disable grouping dynamically.  

    Also, when grouping is enable, we need to change the pageSize because grouping doesn't work well with small page size if your data cover more than 1 page.

    These are the non-working solutions: 

     grid1.setOptions({groupable: false/true, pageable: {pageSize: xyz}});
     grid1.setOptions({groupable: false/true, dataSource: {pageSize: xyz}});

    That is the working solution: (you absolutely need to set BOTH)

     grid1.setOptions({groupable: false/true, pageable: {pageSize: xyz}, dataSource: {pageSize: xyz}});

    If you call

     grid1.setOptions({groupable: true/false});
     grid1.dataSource.pageSize(xyz);
    it works, but you get 2 databind.  

    If you really want to do that "1 shot", you need to set both.
    You can test it there: http://dojo.telerik.com/aJEkA/6

    Maybe Kendo can fix the setOptions to check if the "other" variable needs to be updated as well, to make it work like dataSource.pageSize() method.

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 08 Dec 2015 Link to this post

    Hello Dani,

     

    This behavior is expected, as the DataSource's pageSize needs to be updated as well. We will take your suggestion into consideration for future releases.

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Bill
    Bill avatar
    31 posts
    Member since:
    Mar 2013

    Posted 22 Feb Link to this post

    This is a good post, but is there a way to clear the grouped columns on disable click, so that when the user returns to the paged grid, it is no longer still grouped even though grouping is disabled?

    The attached pic shows the jsFiddle from original author, and if you look carefully, you'll notice that the grid is paged showing 1-20 and the groupby row is disabled, but you still see the col1 and col3 group boxes in the grid.

  5. Bill
    Bill avatar
    31 posts
    Member since:
    Mar 2013

    Posted 22 Feb in reply to Bill Link to this post

    nevermind :)  Just include group with an empty array.

     

    ,dataSource: {pageSize: ps, group: []}

  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 23 Feb Link to this post

    Hi Bill,

    I am happy to hear that the problem has been resolved. In case you have any further questions do not hesitate to contact us.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready