jqgrid中缺少和错误对齐的列标题?

时间:2014-11-11 12:45:25

标签: jquery jqgrid jqgrid-php

我的jqGrid中有3列:'索引','名称','代码'。

enter image description here

我拖动并增加任何行的宽度,以便出现水平滚动,我们位于最右端。 enter image description here

现在,“索引”列部分可见或完全隐藏。 我使用' Code'的搜索工具栏。

enter image description here

我清除了代码'的搜索工具栏。但现在,水平滚动不包括“索引”列,列标题与其数据不一致。

enter image description here

jQuery("#list451").jqGrid({
 url:'localset.php',
 datatype: "json",
 height: 255,
 width: 600,
 colNames:['Index','Name', 'Code'],
 colModel:[ {name:'item_id',index:'item_id', width:65, sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']}},
 {name:'item',index:'item', width:150, sorttype:'string', searchoptions:{sopt:['eq','bw','bn','cn','nc','ew','en']}},
 {name:'item_cd',index:'item_cd', width:100} ], 
rowNum:50, 
rowTotal: 200, 
rowList : [20,30,50], 
loadonce:true, 
mtype: "GET", 
rownumbers: true, 
rownumWidth: 40, 
gridview: true, 
pager: '#pager451', 
sortname: 'item_id', 
viewrecords: true, 
sortorder: "asc", 
caption: "Loading data from server at once" }); jQuery("#list451").jqGrid('filterToolbar',{searchOperators : true});

请查看以上图片

1 个答案:

答案 0 :(得分:1)

您可能需要手动将scrollLeft hDiv属性(带网格所有标题的div)设置为bDiv(带网格主体的div)的值。

我没有工作演示,我可以重现你的问题。您可以尝试在loadComplete中添加以下行:

this.grid.hDiv.scrollLeft = this.grid.bDiv.scrollLeft;

我希望它能解决问题。

相关问题