'style'为null或不是对象

EKS*_*EKS 4 javascript jquery-datatables

我有一些问题与datatables.net和Internet Explorer 8(也可能是其他浏览器,但在IE9中工作).我花了一些时间试图找出问题是什么,我一直无法解决,但我已经找到了似乎触发它的javascript:

如果我删除此代码然后它在IE 8中工作,有人可以指出我的方式错误?

"aoColumns": [
    { "sType": "string" },                       // Player name
    { "sType": "numeric-minus" },                       // Damage done
    { "sType": "numeric-comma", "bVisible": false },    // DPS real
    { "sType": "numeric-comma" },                       // DPS Avg
    {"sType": "numeric-minus" },                        // Damage taken
    {"sType": "numeric-minus" },                        // Healing done
    {"sType": "numeric-comma", "bVisible": false },    // healing done HPS
    {"sType": "numeric-comma" },    // healing done HPS Avg
    { "sType": "numeric-comma" },                       // Overhealing
    { "sType": "numeric-comma" },                       // Healing taken
    { "sType": "numeric-comma", "bVisible": false },    // Mana done
    { "sType": "numeric-comma", "bVisible": false },    // Stamina done
    {"sType": "string", "bVisible": false },            // Class
    {"sType": "percent" },                              // Activity
],
Run Code Online (Sandbox Code Playgroud)

IE 8
网页错误详细信息中的错误详细信息

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Thu, 28 Jul 2011 09:59:45 UTC    

Message: 'style' is null or not an object
Line: 5585
Char: 7
Code: 0
media/js/jquery.dataTables.js
Run Code Online (Sandbox Code Playgroud)

数据表周围的行错误(错误行后面有注释).

函数:_fnGetUniqueThs目的:获取一个唯一的元素数组,每列一个
返回:数组节点:aReturn - 唯一的列表
输入:object:oSettings - dataTables设置对象
节点:nHeader - 自动检测此节点的布局 - 可选
数组对象:aLayout - 来自_fnDetectHeader的thead/tfoot布局 - 可选

var nThs = _fnGetUniqueThs( oSettings, nTheadClone );
iCorrector = 0;
for ( i=0 ; i<iColums ; i++ )
{
    var oColumn = oSettings.aoColumns[i];
    if ( oColumn.bVisible && oColumn.sWidthOrig !== null && oColumn.sWidthOrig !== "" )
    {
        nThs[i-iCorrector].style.width = _fnStringToCss( oColumn.sWidthOrig );
    }
    else if ( oColumn.bVisible )
    {
        nThs[i-iCorrector].style.width = ""; // This is the error line
    }
    else
    {
        iCorrector++;
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 9

问题很可能是aoColumns数组中的最后一个对象:

    {"sType": "percent" },   
],
Run Code Online (Sandbox Code Playgroud)

你在最后一个条目上留下了逗号.我犯了同样的错误,至少在Firefox上工作愉快,但不是IE 8.