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

[Solved] How to programatically set the select list options in pagesizesindropdown

1 Answer 97 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.
Tony
Top achievements
Rank 1
Tony asked on 27 Nov 2011, 01:16 PM
The default pagesizesindropdown shows 5, 10, 20, 50 as choices.  I am changing this array in the grid OnLoad event.  The new assignment seems to take okay in the script but my change is not displayed on the page.

In the grid onload event:
var grid = $(this).data("tGrid");
var sizesInDropDown = [10,20,30,40];
grid.pageSizesInDropDown=sizesInDropDown;

 


Please show me a way to set the select list options to the desired values.

1 Answer, 1 is accepted

Sort by
0
Accepted
SEAN
Top achievements
Rank 1
answered on 25 Sep 2012, 02:18 AM
It is in the GridPagerSettingsBuilder, which is not in the docs for some reason.  It is a second parameter to the PageSize builder method, so where you have this in your declaration

.Pageable(pager => pager.PageSize(20))

just add your size list like this

.Pageable(pager => pager.PageSize(20, new int[] {25, 50, 100, 200})) 

Sean 
Tags
Grid
Asked by
Tony
Top achievements
Rank 1
Answers by
SEAN
Top achievements
Rank 1
Share this question
or