IE9中的jqgrid水平滚动条问题
IE 9在jqgrid上显示一个水平滚动条,而在chrome或mozilla中渲染时则不是这样 以下是我在创建jqgrid时设置的默认配置IE9中的jqgrid水平滚动条问题,jqgrid,Jqgrid,IE 9在jqgrid上显示一个水平滚动条,而在chrome或mozilla中渲染时则不是这样 以下是我在创建jqgrid时设置的默认配置 datatype: "local", colNames: ['Name', 'Note Type', 'Based On', 'Version', 'Status', 'Description', 'Id', 'Tags', 'TemplateId', 'TemplateVersionId', 'IsLocked'], colModel: [
datatype: "local",
colNames: ['Name', 'Note Type', 'Based On', 'Version', 'Status', 'Description', 'Id', 'Tags', 'TemplateId', 'TemplateVersionId', 'IsLocked'],
colModel: [
{ name: 'Name', index: 'Name', title: false, resizable: false, width: 175, classes: 'grid-pointer' },
{ name: 'NoteType', index: 'NoteType', width: 100, title: false, resizable: false, classes: 'grid-pointer', cellattr: function () { return 'style="white-space: normal";"height:auto";"vertical-align:text-top;"'; } },
{ name: 'BasedOn', index: 'BasedOn', width: 100, title: false, resizable: false, classes: 'grid-pointer', cellattr: function () { return 'style="white-space: normal";"height:auto";"vertical-align:text-top;"'; } },
{ name: 'Version', index: 'Version', classes: 'grid-pointer', align: "right", width: 50, title: false, resizable: false },
{ name: 'Status', index: 'Status', width: 80, classes: 'grid-pointer', title: false, resizable: false },
{ name: 'Description', index: 'Description', title: false, resizable: false, width: 135, formatter: self.trimDescription, classes: 'grid-pointer' },
{ name: 'id', index: 'id', hidden: true, title: false },
{ name: 'Tags', index: 'Tags', hidden: true },
{ name: 'TemplateId', index: 'TemplateId', hidden: true },
{ name: 'TemplateVersionId', index: 'TemplateVersionId', hidden: true },
{ name: 'IsLocked', index: 'IsLocked', hidden: true}],
sortname: 'Name',
rowNum: 10,
sortorder: 'asc',
loadonce: true,
viewrecords: true,
multiselect: false,
autowidth:true,
height: 'auto',
rowList: [10, 20, 30],
pager: '#template-grid-pager',
noRecordText: "No records to view",
我有同样的问题,所以我只是通过调用下面的函数来禁用溢出。在我的例子中,我只是在网格使用force-fit时才这样做,因为所有列都应该适合,但是如果不使用force-fit,可以省略条件语句
function jqGridDisableHScroll() {
//if columns are force fit all columns will always fit on screen.
if ($('#yourgrid').jqGrid('getGridParam', 'forceFit')) {
var gridview = $('#gview_yourgrid');
$('.ui-jqgrid-bdiv', gridview).css({ 'overflow-x': 'hidden' });
}
}
注意:如果允许调整列的大小并且未启用强制配合,则需要执行相反的操作。如果你的网格总是这样的话,你也可以通过css来实现这一点。出于理智的考虑,请在你的代码上使用代码标记。要执行此操作,请选择该代码,然后单击工具栏中的“代码”按钮。我无法用现在的方式解析它。详细描述了如何格式化代码。