"style" is zero or not an object

I have some problems with datatables.net and Internet explorer 8 (There may be other browsers, but it works in IE9). I spent some time trying to figure out what the problem was, and I couldn't, but I figured out what kind of javascript that seems to be causing it:

If I delete this code, then it will work in IE 8, can someone point out an error in my paths?

"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 ], 

Error Details from IE 8
Webpage Error Details

 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 

Lines from datatable around error (the error line has a comment behind it).

Function: _fnGetUniqueThs Purpose: get an array of unique elements, one for each column
Returns: array node: aReturn - list of unique ths
Inputs: object: oSettings - settings dataTables object
node: nHeader - automatically determines the layout from this node - optional array object: aLayout - thead / tfoot layout from _fnDetectHeader - optional

 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
source share
3 answers

This code fixed the problem for me, I leave the question open, maybe someone knows why it works with this change.

 "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 ], 
+2
source

This is most likely your last object in the aoColumns array:

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

You left a comma in the last entry. I made the same mistake and it worked with Firefox at least, but not IE 8.

+9
source

in my case, using width="100%" in the table caused the problem by removing the width, resolving it.

working code

 <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> 
0
source

All Articles