jqGrid问题4.1.1:在IE7中更改搜索字段时,禁用搜索运算符选择框

时间:2011-07-06 05:30:29

标签: search jqgrid

问题出现在我的应用程序和从我的IE7,Windows XP系统到达的官方演示中。

在官方演示页面中:http://www.trirand.com/blog/jqgrid/jqgrid.html

例如:

选择“搜索(4.0)新” - > “复杂搜索”

点击导航栏中的“查找记录...”按钮

在第二行选择“客户”而不是“Inv No”

然后将禁用“客户端”旁边的选择框(操作员选择框),并且在过滤后,放在下一个文本字段中的任何内容都将返回无效结果。

我正在使用jqGrid进行产品(学术用途)。所以我需要让它没有错误。

有人能帮我找到解决方案吗?非常感谢!

3 个答案:

答案 0 :(得分:1)

我刚才遇到了同样的问题。

正如上面的答案所说,问题在于

$(".selectopts",trpar).empty().append( s );

我注释掉了这一行,并用

替换了它
$(".selectopts",trpar).parent().html( $("<select class=\"selectopts\">"+s+"</select>").bind('change',function() {
                    rule.op = $(this).val();
                    trpar = $(this).parents("tr:first");
                    var rd = $(".input-elm",trpar)[0];
                    if (rule.op === "nu" || rule.op === "nn") { // disable for operator "is null" and "is not null"
                        rule.data = "";
                        rd.value = "";
                        rd.setAttribute("readonly", "true");
                        rd.setAttribute("disabled", "true");
                    } else {
                        rd.removeAttribute("readonly");
                        rd.removeAttribute("disabled");
                    }

                    that.onchange();  // signals that the filter has changed
                })
            );

我知道这有点笨拙,但这是我能让它发挥作用的唯一方式。

答案 1 :(得分:1)

我替换了

c(".selectopts",j).empty().append(A);

c(".selectopts",j)[0].options.length=0;c(".selectopts",j).append(A);

它有效。

答案 2 :(得分:0)

由于波纹管线引起问题。

在档案jquery.jqGrid.min.js中:

c(".selectopts",j).empty().append(A);

或在档案jquery.jqGrid.src.js中:

$(".selectopts",trpar).empty().append( s );

我不确定如何修复它,但是如果你删除这一行,下拉列表中的操作符将不会被禁用,也不会被更改,所以如果每列都有不同的运算符集,这将无法修复你的问题。

如果你可以对所有列使用相同的运算符,这将是懒惰且简单的解决方案。