IE9中的jqgrid水平滚动条问题

时间:2012-02-07 10:55:47

标签: jqgrid

IE 9在jqgrid上显示水平滚动条,而在chrome或mozilla中呈现则不是这样。

以下是我在创建jqgrid时设置的默认配置

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",

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题所以我只是通过调用以下函数来禁用溢出。在我的情况下,我只是在网格使用强制拟合时才这样做,因为所有列都应该适合,但是如果你不使用强制拟合,你可以省略条件语句。

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这样做,如果你的网格总是如此

相关问题