2013-10-21 11 views

risposta

27

Sembra che IE11 hanno un problema con il suo userAgent. Un'inversione di tendenza è quello di cambiare la funzione clearTableBody (lavorando in jquery.tablesorter-2.0.3.js) come questo:

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

Non funziona per me ... :( –

+0

Schiacciato l'errore! +1 signore. – Bosworth99

20

Questo è in un certo senso a causa di Internet Explorer 11 con una stringa user agent che non lo fa includere "MSIE", quindi jQuery non lo identifica correttamente (vedere this question).

Ma in realtà, il codice TableSorter Pager non ha bisogno di sapere quale browser sta eseguendo il codice. Modificare la funzione clearTableBody di sfruttare implementazione cross-browser di jQuery, invece:

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

Ho testato questo in IE8, IE9, IE11, Chrome 31 e Firefox 24.

(e solo ora, ho trovato un GitHub repo con una forchetta di tablesorter che ha eventualmente fissato già presente: https://github.com/Mottie/tablesorter)

0

una semplice soltion - modificare la linea in jquery.tablesorter.js da if($.browser.msie) a:

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

/msie/.test(navigator.userAgent.toLowerCase()) rileva IE versione 10 o successiva. window.navigator.userAgent.indexOf("Trident/7.0") > 0 rileva IE 11.

Problemi correlati