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

How to get the selected page size in JavaScript?

2 Answers 95 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.
hjbaard
Top achievements
Rank 1
hjbaard asked on 08 Jul 2011, 08:58 AM
I'm working on a website that uses the Telerik MVC grid to display products.
Because I have to do some have calculations (the determine a product price) I only want the calculate the prices for the products currently displaying.

I use ajax to update the list (onDataBinding(e)) and send a parameter list to the controller with the current page (e.page), SortedName, SortedOrder and the page size (value 10).
This worked well until the client asked to make the page size changeable:
.Pageable(p => p.Style(GridPagerStyles.Numeric | GridPagerStyles.NextPreviousAndDropDown)) 

So now I want to know what the current selected page size is in the onDataBinding(e) JavaScript function. But this information is not present in the event parameter (at least I can't find it).

How do I determine the current selected page size?

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Jul 2011, 11:40 AM
Hello Hjbaard,

 You should be able to use the pageSize field of the grid client-side object:

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

Regards,
Atanas Korchev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
hjbaard
Top achievements
Rank 1
answered on 08 Jul 2011, 12:02 PM
Thanks that did the trick!
Tags
Grid
Asked by
hjbaard
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
hjbaard
Top achievements
Rank 1
Share this question
or