Problem with jqGrid 4.1.1: search operator select box is disabled when search field changed in IE7
The problem both occurs in my application and in official demos reached from my IE7, Windows XP system.
In the official demo page: http://www.trirand.com/blog/jqgrid/jqgrid.html
for example:
select开发者_Go百科 "searching (4.0) new" -> "Complex search"
click the "Find records…" button in nav bar
select "Client" instead of "Inv No" at the second line
then the select box next to the "Client" (the operator select box) will be disabled, and anything put in the next text field will return void result after filtering.
I am using jqGrid for product (academic use). So I need to make it error-free.
Could anyone help me to find a solution? Thanks very much!
I just had this exact same problem.
As the answer above said the problem line is
$(".selectopts",trpar).empty().append( s );
I commented out this line, and replaced it with
$(".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
})
);
I know it's a bit hacky, but it's the only way I could get it to work.
I replaced
c(".selectopts",j).empty().append(A);
with
c(".selectopts",j)[0].options.length=0;c(".selectopts",j).append(A);
and it works.
Problem is caused because of bellow line.
In file jquery.jqGrid.min.js
:
c(".selectopts",j).empty().append(A);
or in file jquery.jqGrid.src.js
:
$(".selectopts",trpar).empty().append( s );
I'm not sure how to fix it, but if you remove this line, drop down list of operators will not be disabled, but also not change, so if you have different sets of operators for each column this will not fix your problem.
If you you can use the same operators for all columns, this will be lazy and easy solution.
精彩评论