4

datatables.netとInternetExplorer8に問題があります(他のブラウザーでもかまいませんが、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
],


IE8Webページのエラーの詳細からのエラーの詳細

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

エラー周辺のdatatableからの行(エラー行の後ろにコメントがあります)。

関数:_fnGetUniqueThs目的:列ごとに1つずつ、一意のth要素の配列を取得し
ます戻り値:array node:aReturn-一意のthsのリスト
入力:object:oSettings-dataTables設定オブジェクト
node:nHeader-このノードからレイアウトを自動的に検出します-オプション
配列object: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++;
    }
}
4

3 に答える 3

9

問題は、aoColumns配列の最後のオブジェクトである可能性があります。

    {"sType": "percent" },   
],

最後のエントリにカンマを残しました。私は同じエラーを犯し、少なくともFirefoxで問題なく動作しましたが、IE8では動作しませんでした。

于 2011-11-22T18:45:06.993 に答える
2

このコードを使用して問題を修正しました。質問を開いたままにしておくと、おそらく誰かがこの変更で機能する理由を知っています。

"aoColumns": [
    { "sType": "string", "sWidth": "auto" },                       // Player name
    {"sType": "numeric-minus", "sWidth": "auto" },                       // Damage done
    {"sType": "numeric-comma", "bVisible": false, "sWidth": "auto" },    // DPS real
    {"sType": "numeric-comma", "sWidth": "auto" },                       // DPS Avg
    {"sType": "numeric-minus", "sWidth": "auto" },                        // Damage taken
    {"sType": "numeric-minus", "sWidth": "auto" },                        // Healing done
    {"sType": "numeric-comma", "bVisible": false, "sWidth": "auto" },    // healing done HPS
    {"sType": "numeric-comma", "sWidth": "auto" },    // healing done HPS Avg
    {"sType": "numeric-comma", "sWidth": "auto" },                       // Overhealing
    {"sType": "numeric-comma", "sWidth": "auto" },                       // Healing taken
    {"sType": "numeric-comma", "bVisible": false, "sWidth": "auto" },    // Mana done
    {"sType": "numeric-comma", "bVisible": false, "sWidth": "auto" },    // Stamina done
    {"sType": "string", "bVisible": false, "sWidth": "auto" },            // Class
    {"sType": "percent", "sWidth": "auto" }                              // Activity
],
于 2011-07-28T11:13:57.140 に答える
0

私の場合width="100%"、テーブルで使用すると問題が発生し、幅を削除すると問題が解決しました。

作業コード

<table id="dt_table">
<thead>
<tr>
    <th>column1</th>
    <th>column2</th>
    <th>column3</th>
    <th>column4</th>
    <th>column5</th>
    <th>column6</th>
</tr>
</thead>
</table>
于 2015-04-15T17:43:24.903 に答える