jqgrid导航栏无法正确渲染

我的一些jqGrids在导航栏上有一个奇怪的行为。
在其中一些我使用默认的搜索和刷新按钮,并在那些导航区域浮动左边出现在这些按钮旁边(不应该居中)。

当我向搜索按钮“搜索”添加文本时,会出现最大的问题。 这使得按钮边距被错误地计算,使得hober效果边界比实际按钮宽度短。

但就像我说的那样,这只会在某些情况下发生,我无法弄清楚正常工作和不工作之间的区别。 这不是浏览器问题,因为它在所有浏览器中都是相同的。

Heres是一个截图(注意带焦点的搜索按钮和导航控件位置!): 问题截图

以前有人遇到过这个问题吗?
这是我的配置os网格有这个问题:

$('#ProductBrandListGrid').jqGrid({ url: '', datatype: 'json', mtype: 'GET', colNames: ['Name', 'Description', 'Actions'], colModel: [ { name: 'Name', index: 'Name', width: 100, align: 'left', resizable: true, sortable: true, searchoptions: { sopt: ['cn']} }, { name: 'Description', index: 'Description', align: 'left', resizable: true, sortable: true, searchoptions: { sopt: ['cn']} }, { name: 'act', index: 'act', width: 25, sortable: false, search: false }, ], pager: $('#ProductBrandListGridPager'), rowNum: 15, rowList: [10, 15, 20, 30, 50, 100], sortname: 'Name', sortorder: 'asc', viewrecords: true, imgpath: '', caption: '', width: 200, height: 400, gridComplete: function () { var ids = jQuery("#ProductBrandListGrid").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var cl = ids[i]; ce2 = ""; $("#ProductBrandListGrid").setRowData(ids[i], { act: ce2 }); } } }); /* Add this line to show search boxes on the header */ $('#ProductBrandListGrid').jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false }); /* Add this line to allow advanced search using the toolbar button */ $("#ProductBrandListGrid").jqGrid('navGrid', "#ProductBrandListGridPager", { search: true, edit: false, add: false, del: false, searchtext:"Search" }); 

谢谢,Alex

我今天遇到了这个问题并通过’Inspect Element’注意到由于某种原因,我还有待解决。 这甚至发生在宽度大于415时,以及底部寻呼机上没有自定义按钮的网格。 到目前为止,它似乎是随机的。 发生此问题时,id =’xxxpagername_left’的td标记具有给定的特定宽度。 在没有此问题的网格上,’xxxpagername_left’未设置宽度。 所以,快速解决问题:

 var pagerName = $($grid).jqGrid('getGridParam', 'pager'); $(pagerName + '_left').css('width', 'auto'); 

我有一个ResizeGrid方法,在每个网格的默认loadComplete事件中触发; 在调整网格大小后,代码片段会命中。

不幸的是,我无法将宽度设置为500或大于415的任何成功。

根据Oleg关于电网初始宽度的说法,我去做了一些测试。

正如我所说的,我有其他网格在工具栏上有自定义按钮,并且不像这样,但我找不到任何可能导致此问题的差异。

检查我的其他实现,我看到这只发生在初始宽度较低的那些。 如果我将初始宽度设置为500,则它会正确居中并在setGridWidth上正确地重新定位。 我甚至可以说这个幻数是415.初始宽度低于415px会导致这个……任何等于或高于415px的东西都会使jqGrid按预期运行。 这让我觉得这是某种硬编码的最小宽度导致这种窃听行为。

感谢Oleg的帮助。 亚历克斯