views:

3838

answers:

4

jqGrid exposes a property rowNum where you can set the number of rows to display for each page. How do you set the grid to just display ALL rows?

Right now I'm just setting the rowNum to something really high like <%= int.MaxValue %> but I'm wondering if there is a better way.

A: 

You can also go into jquery.jqGrid.js and change "rowNum:20" to "rowNum:Some-Really-Large-Number". When you define your jqGrid, don't specify rowNum. Then return your entire dataset back to jqGrid.

Ronnie
+3  A: 

if you dont wish to use paging at all then change you server side code to simply return all the rows. dont use the rows parameter at all.

if you want to have the rowlist but also have an option to show all then do something like this in the grid properties

jQuery("#statement_mods").jqGrid({
  rowList:['ALL',30,50,100,200]
});

and then in the serverside code make sure that you ignore the rows parameter if GET['rows']='ALL'

Yash
+2  A: 

jqgrid (3.5 anyway) doesn't seem to have an elegant built in way to do this. The best I have found so far is to add something like the following to your grid options:

rowList:[10,20,30,100000000],
loadComplete: function() {
    $("option[value=100000000]").text('All');
},

Where the 100000000 is some arbitrarily higher number than the maximum # of rows you will ever return, and the option[value=] line is so your user interface looks a little nicer. Jenky, but works for me.

C Dolan
+8  A: 

In the latest version of jqGrid, you can set rowNum to -1 to instruct the grid to always display all rows:

rowNum: -1

See the latest jqGrid documentation here.

Specifically:

Sets how many records we want to view in the grid. This parameter is passed to the url for use by the server routine retrieving the data. Note that if you set this parameter to 10 (i.e. retrieve 10 records) and your server return 15 then only 10 records will be loaded. Set this parameter to -1 (unlimited) to disable this checking.

Justin Ethier