My application has several jqGrids, which may or may not contain enough lines to require a vertical scrollbar. But rows can be dynamically added to these grids after they are created, so the grid may ultimately require a scrollbar.
The problem is that if the grid does not have enough lines that require a scrollbar, there is empty space on the right side of the grid. I would like to somehow fix this - either always show a vertical scrollbar, or somehow dynamically add it if necessary.
I tried adding the following CSS to the .ui-jqgrid-bdiv div grid:
overflow-y: scroll;
Using the following jQuery (the code is ugly, I know):
$("#mygrid").closest(".ui-jqgrid-bdiv").attr("style", $("#mygrid").closest(".ui-jqgrid-bdiv").attr("style") + " overflow-y: scroll; ");
This works fine in Firefox and Chrome, but in IE the grid never displays the scroll bar (no matter how many lines I add, they are added to the bottom of the grid, and the vertical scroll bar never appears).
Any help is appreciated!
jquery scrollbar jqgrid
Justin ethier
source share