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

[Solved] Fixed grid with automatically calculated pagesize?

2 Answers 80 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.
Pat
Top achievements
Rank 1
Pat asked on 23 Feb 2011, 10:14 PM
I setup ajax custom binding with paging and I need to specify the page size at initial load server side (without knowing anything about the browser page, size, etc) and then the grid just naturally renders it's size and takes up whatever space it needs.

How can I make the grid display in a fixed or percentage height size and it just naturally figures out how many rows it can show, and it automatically sets that into the GridCommand when making the ajax call to fetch data?

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 24 Feb 2011, 09:23 AM
Hi pat,

 The grid does not support this behavior out of the box. If you manage to calculate the right page size you can set it like this:

var grid = $("#Grid").data("tGrid");
grid.pageSize = 11;

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Pat
Top achievements
Rank 1
answered on 24 Feb 2011, 07:29 PM
Nice! This worked! I calculate the number of rows from the wrapper div height, I set the grid to that height and also set the pageSize and now I have a page full of results without a scrollbar!
Tags
Grid
Asked by
Pat
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Pat
Top achievements
Rank 1
Share this question
or