在Chrome和Firefox中使用IE8时,以下行给我带来了麻烦:
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
IE8返回"意外调用方法或属性访问"。我尝试了使用getCellIndex(this)
代替this.cellIndex
在其他地方推荐的修补程序,并添加了:
function getCellIndex(aCell) {
aRow = aCell.parentNode;
for (i = 0; i != aRow.cells.length; i++) {
if (aRow.cells[i] == aCell) return i;
}
}
...并被告知" cells.length为null或不是对象"。
有关如何进行的任何建议将不胜感激。以下功能的相关部分,问题在第6行:
$tableHeaders = $(c.selectorHeaders, table)
.wrapInner("<div class='tablesorter-header-inner' />")
.each(function(index) {
$t = $(this);
ch = c.headers[index];
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
this.count = -1; // set to -1 because clicking on the header automatically adds one
if (ts.getData($t, ch, 'sorter') === 'false') { this.sortDisabled = true; }
this.lockedOrder = false;
lock = ts.getData($t, ch, 'lockedOrder') || false;
if (typeof(lock) !== 'undefined' && lock !== false) {
this.order = this.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
}