This is a migrated thread and some comments may be shown as answers.

How to change pageSize using setOptions with pageable enabled

4 Answers 400 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bridge24
Top achievements
Rank 1
Iron
Bridge24 asked on 04 Dec 2015, 09:08 PM

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.

4 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 08 Dec 2015, 08:39 AM

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!
 
0
Bill
Top achievements
Rank 2
answered on 23 Feb 2016, 01:27 AM

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.

0
Bill
Top achievements
Rank 2
answered on 23 Feb 2016, 01:33 AM

nevermind :)  Just include group with an empty array.

 

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

0
Kiril Nikolov
Telerik team
answered on 23 Feb 2016, 08:55 AM
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!
 
Saul
Top achievements
Rank 1
commented on 09 Dec 2023, 10:32 PM

This post is many years old but it has solved my problem. This is the part that I was missing!

grid1.dataSource.pageSize(xyz);

Thank you

Tags
Grid
Asked by
Bridge24
Top achievements
Rank 1
Iron
Answers by
Kiril Nikolov
Telerik team
Bill
Top achievements
Rank 2
Share this question
or