Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid - do not display scrollbars

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.

like image 594
Marcus Leon Avatar asked Sep 17 '10 15:09

Marcus Leon


People also ask

How do I get rid of the scroll bar in Jqgrid?

It is not possible. You could create tiny scrollbar – scrollbarsize: 5 property.


2 Answers

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'),
        ...
    }, 
like image 114
Adam Morris Avatar answered Oct 20 '22 00:10

Adam Morris


It seems this can be done with scrollOffset:0. Saw this tip here

like image 32
Marcus Leon Avatar answered Oct 19 '22 22:10

Marcus Leon