Error in IE 6, 7

Error in IE 6, 7

tstartstar Posts: 36Questions: 0Answers: 0
edited July 2012 in Bug reports
Hello!
v1.9.2
If I use aoColumns (all browsers) or aoColumnDefs in IE9 and other browser then all fine.
But when I use aoColumnDefs in IE 6, 7 (8 - not tested) i have strange error in jquery.dataTables.js on line 376 like "aTargets": is null. It's strange, because in IE 6,7 aoColDefs.length is 1 more than it actually defined. For example:

"aoColumnDefs": [
{ "aTargets": [0], "sTitle": "Contract", "mDataProp": "Contract", "sClass": "cr" },
]

Defined 1 column? but in IE 6,7 aoColDefs.length = 2.


// Column definitions with aTargets
if ( aoColDefs )
{
/* Loop over the definitions array - loop in reverse so first instance has priority */
for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
{
/* Each definition can target multiple columns, as it is an array */
var aTargets = aoColDefs[i].aTargets; - in this place I have exception "aTargets": is null

Is it posible to correct this problem?

Then you/

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    You have a trailing comma in your aoColumnDefs array - see http://datatables.net/faqs#comma

    Allan
  • tstartstar Posts: 36Questions: 0Answers: 0
    It is very strange. I have not found an trailing comma in my code. Today, I uncommented code with aoColumnDefs array and everything worked as it should. Maybe it's my night glitches. Excess trailing comma in the message - this is an copy/paste error from main code.

    I checked your version and you're right. Excess trailing comma cause this same error.

    Many thanks for your help and support.

    Good luck.
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    You posted this before:

    [code]
    "aoColumnDefs": [
    { "aTargets": [0], "sTitle": "Contract", "mDataProp": "Contract", "sClass": "cr" },
    ]
    [/code]

    Line 2 - right at the very end.

    Allan
  • tstartstar Posts: 36Questions: 0Answers: 0
    Yes! Error in this sample, but in main code, where 12 columns and where from i copy first line, I didn't found excess trailing comma today. May be problem in my eyes and head at 02:48 at local time or it is mysticism :). Datatables the best control. I like it. Thank you.
This discussion has been closed.