Jqgrid -- search button doesn't work with Jquery 1.8.0 or greater

search functionality code:

$("#devicesTable").jqGrid('navGrid', '#pager', {
   del : false,
   add : false,
   edit : false,
   afterRefresh : function() {
       ...
   }

}, {}, {}, {}, {
   multipleSearch : true,
   multipleGroup : true,
   sopt : [ 'cn', 'eq' ]
});


I struggled with the same issue, and after I while I found the reason that jQgrid search does not work with jQuery 1.8.3:

In my jquery.jqGrid.js (v 4.3.3) i found this:

if($("#"+ $.jgrid.jqID(IDs.themodal)).html()!==null){

   showFilter($("#fbox_"+ $.jgrid.jqID(+$t.p.id)));

}

In jquery.jqGrid.min.js as follows:

if(null!==a("#"+a.jgrid.jqID(t.themodal)).html())d(a("#fbox_"+a.jgrid.jqID(+e.p.id)));


In my file it was on line 6863, but you may have to search for it, since my file may be a bit modified compared to the original.

The problem is that $([id]).html() evaluates to null in older jQuery versions, while in jQuery 1.8.0 it instead evaluates to undefined! Since (undefined !== null) is true and (null !== null) is false, the code does different things with different versions of jQuery.

What I did to fix it, and make it work with jQuery 1.8.0 was to change the comparator from !== to !=. This works since both (null != null) and (null != undefined) evaluates to true!

Hope this could be of help!


link to http://stackoverflow.com/questions/12199400/jqgrid-search-button-does-nothing


你可能感兴趣的:(jquery,jqGrid,with,search,button,work,doesn't)