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

Paging - dynamic pagesize?

2 Answers 172 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jas
Top achievements
Rank 1
jas asked on 08 Apr 2010, 05:14 PM
I am using the Telerik gridview and the RadDataPager quite successfully. However how should you set the page size to cope with an adjustable container window size when the grid size is set to auto? The choice seems to be to set it to a low number to avoid vertical scrolling but have lots of space below the grid when the window is maximised, or accept vertical scrolling with a much large page size.
In an MVVM design, how would you set the page size according to physical grid and window sizes, also taking into account the group panel, for example, which might be shown or not? - or have I missed some existing functionality?

Thanks

jas


2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 09 Apr 2010, 12:06 PM
Hi jas,

Currently this is impossible.

Actually, the grid is not even aware that someone is paging it. It is simply displaying the data which is in its ItemsSource. This data can be returned from a DomainDataSource.Data or from RadDataPager's PagedSource property. In other words if the PageSize of the DomainDataSource is 10 for example, RadGridView simply thinks that there are 10 records in its items source. It is totally unaware of the larger context that data is coming from. When the domain data source moves to the next page, the grid simply thinks that the records inside its ItemsSource have changed. But it does not recognize paging as a concept.

Please, read my extensive blog post on the subject, in case you have not already done so.

You might be able to create a custom solution for this but I am not sure whether this is reasonable. Maybe you can attach to the SizeChanged property of the grid and calculate? how many rows will fit in the new size, and then change the PageSize property of the thing that is feeding data to the grid (DDS or RadDataPager). I am not sure how you would be able to get this calculation since each row can have variable height. For example, if you have row details expanded for every row, the row details of each row can have arbitrary height. So the calculation is almost impossible to make. I will not even mention grouped scenario which makes things even worse.

So I am afraid that the functionality that you require is currently impossible to achieve.

Thank you for your understanding.

Greetings,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
jas
Top achievements
Rank 1
answered on 09 Apr 2010, 12:17 PM
I had indeed read your useful blog post and do understand the points about the grid's awareness of data - or lack of it, and also the many complications involved: imagine how the paging would perform or work at all as the user dragged the corner of a window around!?

The request came from a client and I wondered what your thoughts would be. I have set the page size to be such that at the highest resolution, the area is always filled with rows and a vertical scroll bar is visible if necessary.

Many thanks

James.

Tags
GridView
Asked by
jas
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
jas
Top achievements
Rank 1
Share this question
or