jqGrid过滤器行与网格列不同步

chu*_*h97 1 jquery-plugins jqgrid

请看我的jsFiddle发布:

http://jsfiddle.net/chugh97/w3Kzt/1/

我有一个固定宽度的jqGrid,启用了滚动和shrinktofit:false.现在,当我通过jqGrid过滤器文本框中的第4个字段进行选项卡时,过滤器文本框与jqGrid列无关.怎么解决这个问题?

Ole*_*leg 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);
    });
Run Code Online (Sandbox Code Playgroud)

setTimeout例如,在Google Chrome网络浏览器中需要使用.

请在此处查看演示.