Is there a way to not display the scrollbars? We'd like to also NOT show the extra space where the scrollbars would go if our data didn't fit on the grid.
It is not possible. You could create tiny scrollbar – scrollbarsize: 5 property.
You can set the height
and width
to 100%, and then the scrollbars won’t appear. They only appear if the grid is larger than the space allocated. To remove the extra space for the bars, set scrollOffset
to 0.
Here's an example grid definition (corrected version below):
$("#myGrid").jqGrid({
url: 'datasourceurl',
datatype: "json",
colNames: eval(json.colNames),
colModel: eval(json.colModel),
rowNum: -1,
width: 100%,
height: 100%,
scrollOffset: 0,
rowList: [10, 20, 30],
pager: jQuery('#myPager'),
...
},
I haven’t tested this, but I use height: 100%
for the same purpose... so let me know if you see anything missing.
EDIT: A better definition, and improvement on my json usage - thank you Oleg :)
$("#myGrid").jqGrid({
url: 'datasourceurl',
datatype: "json",
colNames: JSON.parse(json.colNames),
colModel: JSON.parse(json.colModel),
width: '100%',
height: '100%',
rowList: [10, 20, 30],
pager: jQuery('#myPager'),
...
},
It seems this can be done with scrollOffset:0
. Saw this tip here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With