I developed AJAX interface with jQuery and jqGrid.
How I can remove horizontal scrollbar from my jqGrid table?
http://dskarataev.ru/jqgrid.png
If I s
Add the below script to your style.css will resolve your issue.
.ui-jqgrid .ui-jqgrid-bdiv {
overflow-x:hidden !important;
overflow-y:auto !important;
}
Here we go width : '1083'
, shrinkToFit:false,
When we set the above we need to make sure that our ui.jqgird.css
are set as below
.ui-jqgrid .ui-jqgrid-bdiv { height: auto; margin: 0em; max-height: 250px; overflow-x: auto; overflow-y: auto; padding: 0px; position: relative; text-align: left; }
Here is how I did it and so far, so good. Basically, we resize the grid to accommodate the vertical scroll bar and by resizing, there is no horizontal overflow and therefore, the horizontal bar never shows up. Our cell sizing remains the same and the last cell is not partially hidden.
loadComplete: function (data) {
//set our "ALL" select option to the actual number of found records
$(".ui-pg-selbox option[value='ALL']").val(data.records);
if ($(".ui-jqgrid").height() > $('#grid').getGridParam('maxHeight')) {
//resize our grid for the vertical scroll bar to eliminate the hortizontal scroll bar
$(".ui-jqgrid").css("width", $('#grid').getGridParam('width') + 20);
$(".ui-jqgrid-bdiv").css("width", $('#grid').getGridParam('width') + 17);
$(".ui-jqgrid-hdiv").css("width", $('#grid').getGridParam('width') + 20);
$(".ui-jqgrid-view").css("width", $('#grid').getGridParam('width') + 20);
$("#pager").css("width", $('#grid').getGridParam('width') + 20);
$(".ui-jqgrid-hbox").css("padding-right", "16px");
} else { //set everything to defaults
$(".ui-jqgrid").css("width", $('#grid').getGridParam('width'));
$(".ui-jqgrid-bdiv").css("width", $('#grid').getGridParam('width'));
$(".ui-jqgrid-hdiv").css("width", $('#grid').getGridParam('width'));
$(".ui-jqgrid-view").css("width", $('#grid').getGridParam('width'));
$("#pager").css("width", $('#grid').getGridParam('width'));
$(".ui-jqgrid-hbox").css("padding-right", "0px");
}
}
Its simple, use in the jqgrid shrinkToFit: false
Apply AppearanceSettings ShrinkToFit="False"
and AutoWidth="true"
to your jqGrid
.
i adjusted ui.grid.css because i did not need a horizontal scrollbar at all. i did this:
.ui-jqgrid .ui-jqgrid-bdiv {
position: relative;
margin: 0em;
padding:0;
/*overflow: auto;*/
overflow-x:hidden;
overflow-y:auto;
text-align:left;
}
the commented was how it was, i just used overflow-x to hide the horizontal scrollbar and now all is fine with me.