问题描述:

I use jqgrid at my page. I wanted to have fixed height at it (Users should scroll down if there is more rows). It works for tables which has many rows. However even table row size is not much there is a place for scroll bar (number 2 at image) and there is an extra line at left (number 1 at image). This is same for each table. Here is an example of my tables:

I used that at my options:

...

height: '150'

jsonReader: {

repeatitems: false

},

loadui: 'disable',

altRows: true,

viewrecords: true,

loadonce: true,

...

and did not do anything special to height.

Any ideas?

网友答案:

You don't posted any details about how you use jqGrid. So I can suppose that you use height option with some integer value. If you would use height: "auto" or height: "100%" then you would not have the described problem. I personally use almost always height: "auto" and specify the maximal grid width by usage rowNum value.

jqGrid calculate the width of the grid based on the total width of all columns. If the value of height option is neither "auto" nor "100%" it adds additional space to hold possible vertical scroll bar. You can use scrollOffset: 0 option to remove unneeded space of the right size of the grid. Alternatively you can call setGridWidth and setGridHeight methods to set width and height of the grid explicitly on any other value which you want.

相关阅读:
Top