溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

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

發(fā)布時(shí)間:2020-06-06 02:51:12 來(lái)源:網(wǎng)絡(luò) 閱讀:684 作者:wander_bird 欄目:web開(kāi)發(fā)

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


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI