簡體   English   中英

在Edge模式下,JQuery tablesorter pager插件無法與IE11一起正常工作

[英]JQuery tablesorter pager plugin doesn't work properly with IE11 in Edge mode

如果您使用Tablesorter Jquery插件與頁面上的分頁器添加將不會顯示任何數據。 數據在那里,但它是隱藏的。

我懷疑該插件的瀏覽器功能檢測方法無法處理IE11。

其他人遇到這個?

IE11似乎與他的userAgent有問題。 一個轉變是改變clearTableBody函數(在jquery.tablesorter-2.0.3.js中工作),如下所示:

this.clearTableBody = function (table) {
    //if ($.browser.msie) {
        function empty() {
            while (this.firstChild) this.removeChild(this.firstChild);
        }
        empty.apply(table.tBodies[0]);
    //} else {
    //    table.tBodies[0].innerHTML = "";
    //}
};

這是因為Internet Explorer 11具有不包含“MSIE”的用戶代理字符串,因此jQuery無法正確識別它(請參閱此問題 )。

但實際上,TableSorter 呼叫器 代碼不需要知道哪個瀏覽器正在運行代碼。 更改函數clearTableBody以改為利用jQuery的跨瀏覽器實現:

this.clearTableBody = function(table) {
    $(table.tBodies[0]).empty();
};

我在IE8,IE9,IE11,Chrome 31和Firefox 24中測試了這個。

(剛才,我發現了一個帶有TableSorter分支的GitHub倉庫,可能已經解決了這個問題: https//github.com/Mottie/tablesorter

我們有同樣的問題。 我已經直接向微軟提交了一張票。

等着瞧...

https://connect.microsoft.com/IE/feedback/details/806279/bug-when-sorting-with-a-jquery-plugin

一個簡單的解決方法 - 將jquery.tablesorter.js中的行從if($.browser.msie)更改為:

if(/msie/.test(navigator.userAgent.toLowerCase()) || window.navigator.userAgent.indexOf("Trident/7.0") > 0)適合我。

/msie/.test(navigator.userAgent.toLowerCase())檢測IE 10或更低版本。 window.navigator.userAgent.indexOf("Trident/7.0") > 0檢測到IE 11。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM