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

[Solved] Grid Height Consistent While Paging?

3 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ben
Top achievements
Rank 1
Ben asked on 28 Jun 2011, 08:39 PM
We are using a Telerik Grid with paging in our MVC3/Razor project.  The grid pageable settings (including GridPagerPosition.Bottom) are set in .cshtml using:
.Pageable(paging => paging.PageSize(10).Style(GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Bottom))

It is a project requirement that the paging controls exist at the bottom of the grid.

The problem occurs on the last page of a grid's data when there are fewer items on the grid page than the grid's PageSize.  When a user navigates to the last page, the height of the grid gets shorter.  This causes the paging control to move up the page, away from the user's mouse cursor.

The question is:  Is there a way to fill the last page of a grid with empty space so that the grid retains a consistent height on all grid pages during grid page navigation?

Teleric.Web.MVC.dll is v4.0.30319

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 29 Jun 2011, 06:41 AM
Hello Ben,

You can achieve the desired behavior if you enable Grid scrolling, as in this demo:

http://demos.telerik.com/aspnet-mvc/Grid/Paging?theme=vista

As a result, the Grid data will be placed inside a scrollable container with a fixed height and the pager will always be a the same position.

Regards,
Dimo
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
Ben
Top achievements
Rank 1
answered on 29 Jun 2011, 03:52 PM
Thank you so much, Dimo.  Setting the grid as scrollable and setting height in the View works as expected to keep the grid height consistent on every page.  This specific code in the View achieved that result:

.Scrollable(scrolling => scrolling.Height("200px"))


I do wonder, however, if there is a way to get a fixed height grid without displaying a scrollbar on the side of the grid.  This would be for scenarios where we know that the contents of the grid will not exceed the static height set in the View.
0
Happy
Top achievements
Rank 1
answered on 20 Jul 2011, 12:03 AM
What I would like is for the grid to stay consistent while paging, but instead of a fixed grid height, a percentage fill so that I can have the grid use up all the available vertical space.  Then the grid could figure out how many rows fit in that vertical space and automatically set the pagesize.
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Ben
Top achievements
Rank 1
Happy
Top achievements
Rank 1
Share this question
or