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

Problem with the default paging in kendo grid

5 Answers 1056 Views
Grid
This is a migrated thread and some comments may be shown as answers.
zhivko.zhelezov
Top achievements
Rank 1
zhivko.zhelezov asked on 19 Jan 2016, 08:39 AM

Hi folks,

 I am experiencing the following problem: in my scenario I have a grid, which loads data, based on a date interval picker. I have decided to enable client side paging as the requested data can be around 2000 up to 10000 rows. My paging options are the following:

vm.gridOptions = {
           sortable: true,
           filterable: true,
           groupable: true,
           scrollable: true,
           reorderable: true,
           resizable: true,
           pageable: true,
           pageable: {
               pageSizes: [50, 100, 500, 'all'],
               buttonCount: 5,
           },

and in the dataSource of the grid I have specified pageSize as 50, because I was observing some strange behavior.  

So to explain the problem: when I load data for some interval and for example receive 600 elements, when "ALL" is selected as option it display all the data on one page. After that if I leave all as pageSize and extend the interval for the grid and more data is received in the datasource (lets say 900 elements), the pageSize becomes the old value of ALL - 600, two pages appear and the second page contains the rest of the data (300 elements). 

 As you can see from the images provided, if the next loaded period doesn't contain any information, the pageSize still remains with the last value of All. Just to mention that we are talking about an angular app (v1.4.4) with Kendo UI v2015.3.930. Thank you in advance.

 

5 Answers, 1 is accepted

Sort by
0
zhivko.zhelezov
Top achievements
Rank 1
answered on 19 Jan 2016, 08:42 AM
Just to say that all other pageSizez works well and the problem appears only with All.
0
Alexander Popov
Telerik team
answered on 21 Jan 2016, 09:33 AM
Hi Zhivko,

I managed to reproduce this behavior, which seems to occur because the pageSize is not taking the new total into consideration. I will forward this to our development team for further analysis. Meanwhile, you can manually update the pageSize after applying the filter. For example: 
grid.dataSource.pageSize(grid.dataSource.total());

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
zhivko.zhelezov
Top achievements
Rank 1
answered on 21 Jan 2016, 09:54 AM
Ok but as I said, this happens only when the pageSize is set to ''all'.  In that case what would be the conditional check for it? (dataSource.pageSize() is always a number).
0
zhivko.zhelezov
Top achievements
Rank 1
answered on 21 Jan 2016, 11:18 AM
and also to note that setting the pageSize doesn't refresh the pager ... so that when it is set to grid.dataSource.total() the number of pages can be more than 1.
0
Alexander Popov
Telerik team
answered on 25 Jan 2016, 09:32 AM
Hello again Zhivko,

This is a limitation in the current implementation, which relies on the total method for determining the pageSize. Since filtering also affects the total, you can check the length of the dataSource's data array. Keep in mind that this will work only when client-side filtering and paging are used. Here is a proof of concept example and a short screencast.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
zhivko.zhelezov
Top achievements
Rank 1
Answers by
zhivko.zhelezov
Top achievements
Rank 1
Alexander Popov
Telerik team
Share this question
or