请看我的jsFiddle张贴:
http://jsfiddle.net/chugh97/w3Kzt/1/
我有一个固定宽度的jqGrid,启用了滚动和shrinktofit:false。现在,当我通过jqGrid过滤器文本框中的第4个字段进行选项卡时,过滤器文本框与jqGrid列无关。如何解决这个问题?
答案 0 :(得分:5)
jqGrid对键盘导航的支持非常有限。我同意你描述的问题存在于jqGrid的当前(v.4.3.1)实现中。所以我可以提出+1问题。
要解决此问题,我建议以下
$('#grid').closest('.ui-jqgrid-view')
.find('.ui-jqgrid-htable .ui-search-toolbar .ui-th-column')
.find('input, select')
.focus(function (e) {
var $header = $(e.target).closest('.ui-jqgrid-hdiv'),
$body = $header.siblings('.ui-jqgrid-bdiv');
setTimeout(function () {
// we syncronize the scroll in the separate thread
// to be sure that the new scrolling value
// already set in the grid header
$body[0].scrollLeft = $header[0].scrollLeft;
}, 0);
});
例如,Google Chrome网络浏览器需要使用setTimeout
。
请参阅演示here。