Possible bug: IE8 won't show table: "'aTargets' is null or not an object"

Possible bug: IE8 won't show table: "'aTargets' is null or not an object"

GrantBGrantB Posts: 9Questions: 0Answers: 0
edited August 2012 in DataTables 1.9
I've got a datatable that works in Opera/FF/Chrome, but not in IE8. I'm running 1.9.3.

In IE8, it shows this error:
[code]Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.4506.2152)
Timestamp: Tue, 21 Aug 2012 20:16:07 UTC

Message: 'aTargets' is null or not an object
Line: 19
Char: 4817
Code: 0
URI: http://MYDOMAIN/assets/application-3b0e185edc6cf38f7bdac3207f7b8585.js
[/code]

In the min.js code, it corresponds to this bit:
[code]function ua(e,t,n,r){var s,u,a,f,l;if(t)for(s=t.length-1;0

Replies

  • GrantBGrantB Posts: 9Questions: 0Answers: 0
    And here's my full aoColumnDefs, because if it's my fault, I'm guessing it would be in here:
    [code]$("#trades_tbl").dataTable({
    "sAjaxSource" : "/trades/search.datatables",
    // "aaSorting" : [[0,'asc']], // sorting on initialization
    "bServerSide" : true,
    "fnServerData" : simpleDatatables,
    "bFilter" : false,

    "sDom" : "lfriptip",

    // pagination
    "aLengthMenu" : [10,50,100,500,1000],
    "bPaginate" : true,
    "bLengthChange" : true, // lets user choose number of records from menu
    "sPaginationType" : "input",

    "aoColumnDefs": [
    { "aTargets": ["id"], "bVisible":false },
    { "aTargets": ["tddt"], "sName":"tddt" },
    { "aTargets": ["bors"], "sName":"bors" },
    { "aTargets": ["quanty"], "sName":"quanty" },
    { "aTargets": ["exch"], "sName":"exch" },
    { "aTargets": ["fcondt"], "sName":"fcondt" },
    { "aTargets": ["desc"], "sName":"desc" },
    { "aTargets": ["porc"], "sName":"porc" },
    { "aTargets": ["trntp"], "sName":"trntp" },
    { "aTargets": ["fprice"], "sName":"fprice" },
    { "aTargets": ["cmns"], "sName":"cmns" },
    { "aTargets": ["strik"], "sName":"strik" },
    { "aTargets": ["excf"], "sName":"excf" },
    { "aTargets": ["exsf"], "sName":"exsf" },
    { "aTargets": ["nfa"], "sName":"nfa" },
    { "aTargets": ["altcur"], "sName":"altcur" },
    { "aTargets": ["regcod"], "sName":"regcod" },
    { "aTargets": ["acctno"], "sName":"acctno" },
    { "aTargets": ["trncde"], "sName":"trncde" },
    { "aTargets": ["price"], "sName":"price" },
    { "aTargets": ["nitd"], "sName":"nitd" },
    { "aTargets": ["pandl"], "sName":"pandl" },
    { "aTargets": ["cnyear"], "sName":"cnyear" },
    { "aTargets": ["month"], "sName":"month" },
    { "aTargets": ["fprmpt"], "sName":"fprmpt" },
    { "aTargets": ["futcod"], "sName":"futcod" },
    { "aTargets": ["foro"], "sName":"foro" },
    { "aTargets": ["slspsn"], "sName":"slspsn" },
    { "aTargets": ["crncod"], "sName":"crncod" },
    { "aTargets": ["stlpr"], "sName":"stlpr" },
    { "aTargets": ["txty"], "sName":"txty" },
    { "aTargets": ["txcd"], "sName":"txcd" },
    { "aTargets": ["brokr"], "sName":"brokr" },
    { "aTargets": ["txno"], "sName":"txno" },
    { "aTargets": ["cmsty"], "sName":"cmsty" },
    { "aTargets": ["futmcd"], "sName":"futmcd" },
    { "aTargets": ["orgzcd"], "sName":"orgzcd" },
    { "aTargets": ["feerec"], "sName":"feerec" },
    { "aTargets": ["fbkr"], "sName":"fbkr" },
    { "aTargets": ["feeamt"], "sName":"feeamt" },
    { "aTargets": ["feectc"], "sName":"feectc" },
    { "aTargets": ["feehf"], "sName":"feehf" },
    { "aTargets": ["sdbk"], "sName":"sdbk" },
    { "aTargets": ["edit","destroy"], "bSortable":false, "bSearchable":false },
    { "aTargets": ["edit"], "sDefaultContent":"",
    "fnRender" :function(o) {
    return 'Edit'
    },
    },
    { "aTargets": ["destroy"], "sDefaultContent":"",
    "fnRender" :function(o) {
    return 'Destroy'
    },
    },
    ],
    });
    [/code]
  • allanallan Posts: 40,509Questions: 1Answers: 4,943 Site admin
    you've got trailing commas at the end of the aoColumnDefs array and the init object. IE does not behave the same way as other browsers with the trailing comma - here is it inserted an undefined element at the end of the array, while older IE versions will throw an error.

    Allan
  • GrantBGrantB Posts: 9Questions: 0Answers: 0
    Argh! Thanks, Allan, you nailed it!
This discussion has been closed.