2

在 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 为空或不是对象”。

任何有关如何进行的建议将不胜感激。下面函数的相关部分,麻烦在第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];
                }
4

0 回答 0