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

后端 未结 4 1287
一个人的身影
一个人的身影 2021-02-07 05:16

If you are using the Tablesorter Jquery plugin with the pager add on the table will not display any of the data. The data is there but it is hidden.

I suspect the browse

相关标签:
4条回答
  • 2021-02-07 05:28

    We have the same problem. I've submitted a ticket directly to Microsoft.

    Wait... and see...

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

    0 讨论(0)
  • 2021-02-07 05:34

    One simple soltion - change the line in jquery.tablesorter.js from if($.browser.msie) to:

    if(/msie/.test(navigator.userAgent.toLowerCase()) || window.navigator.userAgent.indexOf("Trident/7.0") > 0) works for me.

    /msie/.test(navigator.userAgent.toLowerCase()) detects IE version 10 or below. window.navigator.userAgent.indexOf("Trident/7.0") > 0 detects IE 11.

    0 讨论(0)
  • 2021-02-07 05:45

    This is in a way due to Internet Explorer 11 having a user agent string that doesn't include "MSIE", so jQuery doesn't identify it properly (see this question).

    But really, the TableSorter Pager code doesn't need to know which browser is running the code. Change the function clearTableBody to leverage jQuery's cross-browser implementation instead:

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

    I have tested this in IE8, IE9, IE11, Chrome 31 and Firefox 24.

    (And just now, I found a GitHub repo with a fork of TableSorter that has possibly fixed this already: https://github.com/Mottie/tablesorter)

    0 讨论(0)
  • 2021-02-07 05:52

    It seems that IE11 have a problem with his userAgent. A turnaround is to change clearTableBody function (working in jquery.tablesorter-2.0.3.js) like this :

    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 = "";
        //}
    };
    
    0 讨论(0)
提交回复
热议问题