Jim carry
Jim carry

Reputation: 69

jqGrid: How to set value of rowList as soon as the grid load first time

I have a jqGrid with the following configuration -

var PAGER_COMBO:[5,10,15,20,25,40,50],
var grid_default={
    rowNum: ($("#contentPanel").height()/30).toFixed(),
    height: $("#contentPanel").height(),
    rowList: jsVar.PAGER_COMBO,
 };

It is clear that the grid height is dynamic and it will change when the screen(monitor) size will be changed. And I have considered that each row height will be 30. So the total rowNum of grid will be also dynamic. And rowList is a pre-defined list.

Suppose for a big monitor the height will be 900. In that case rowNum will be 900/30=30. I want that this 30 will be added in the rowList automatically and will be default selected as soon as the grid loaded. Is it possible ?

Update 1 : Attached an image for better giving better explanation of the issue.

enter image description here

Upvotes: 0

Views: 4308

Answers (1)

Oleg
Oleg

Reputation: 221997

I'm not sure that I understand your question correctly. If you want to set rowNum to some value, which depends from "the screen(monitor) size" then you can do this. You can just make all required calculations, and then create the grid with the options which you want. You can generate rowList which you want before the grid will be created and use the array as the input parameter. You can sort the items of the array, used as rowList parameter, and don't include duplicates. All what you need is to write some lines of JavaScript code before jqGrid will be created.

Upvotes: 2

Related Questions