jqGrid中的水平滚动条

时间:2011-11-24 08:17:50

标签: jquery jqgrid

我在项目的两个地方使用jqGrid。

在第一个示例代码中,它正在运行,水平条显示...

第一个jqGrid的示例代码 示例代码:

jQuery("#list2").jqGrid({
    url:'server1.php?P1=ACNO,APHID',
    datatype: "json",
    colNames:[
        'ACNO','APHID'
    ],
    colModel:[
        {name:'ACNO',index:'ACNO', width:80, sortable:true, search:true},
        {name:'APHID',index:'APHID', width:80, sortable:true, search:true}
    ],
    rowNum:100,
    rowList:[100,200,300,400],
    pager: '#pager2',
    loadonce: true,
    sortname: 'geneID',
    viewrecords: true,
    width:700,
    shrinkToFit:false,
    height:700,
    sortorder: "desc",
    caption:"Breeder Tool Box"
});

第二个jqGrid的示例代码 示例代码:

jQuery("#list2").jqGrid({
    url:'server4.php?P1=NEMATODE',
    datatype: "json",
    colNames:['Linkage_group','Chromosome','Start_Position','Stop_Position','Start','End','geneID','Feature_Type','Feature_Name','Mstart','Mstop','Trait'],
    colModel:[
        {index: 'Linkage_group', name: 'Linkage_group',width:170, sortable:true, search:true},
        {index: 'Chromosome', name: 'Chromosome',width:170, sortable:true, search:true},
        {index: 'Start_Position', name: 'StartPos',width:170, sortable:true, search:true},
        {index: 'Stop_Position', name: 'StopPos',width:170, sortable:true, search:true},
        {index: 'Start', name: 'Start',width:170, sortable:true, search:true},
        {index: 'End', name: 'End',width:170, sortable:true, search:true},
        {index: 'geneID', name: 'geneID',width:170, sortable:true, search:true,formatter: formatOperations},
        {index: 'Feature_Type', name: 'Feature_Type',width:170, sortable:true, search:true},
        {index: 'Feature_Name', name: 'Feature_Name',width:170, sortable:true, search:true},
        {index: 'Mstart', name: 'Mstart',width:170, sortable:true, search:true},
        {index: 'Mstop', name: 'Mstop',width:170, sortable:true, search:true},
        {index: 'Trait', name: 'Trait',width:170, sortable:true, search:true}],
    rowNum:100,
    rowList:[100,200,300,400],
    pager: '#pager2',
    loadonce: true,
    shrinkToFit:false,
    viewrecords: true,
    width:700,
    height:700,
    sortorder: "desc",
    caption: "Breeder Tool Box",
    sortname: 'Linkage_group'
});

第二个网格的jqGrid全部失真,没有水平条。 我无法找到这两个代码之间的差异,  你能指出我的错误在哪里吗?

1 个答案:

答案 0 :(得分:4)

你可以用css做到这一点。在ui.grid.css

中更改以下内容
.ui-jqgrid .ui-jqgrid-bdiv {
  position: relative; 
  margin: 0em; 
  padding:0; 
  /*overflow: auto;*/ 
  overflow-x:visible; 
  overflow-y:auto; 
  text-align:left;
}