Microsoft JScript runtime error: 'style' is null or not an object

Microsoft JScript runtime error: 'style' is null or not an object

MaggotMaggot Posts: 2Questions: 0Answers: 0
edited May 2011 in DataTables 1.8
Hello all, thanks for taking the time to look at this problem.

I am using Visual Studio 2005 to build a website using DataTables. It works fantastically in the better browsers (Opera, Firefox and Safari) but I continue to get the error above in IE (Version 8) which halts the code and fails to format the table as expected.

I have searched the forum for similar topics and wondered if there was a fix or step I need to carry out to stop this error.

I am using the following code:


$(document).ready(function () {

//Set the results table
oTable = $('#example').dataTable({
"bProcessing": true,
"bJQueryUI": true,
"iDisplayLength": 35,
"bLengthChange": false,
"aoColumns": [{ "sSortDataType": "dom-text" }, { "sSortDataType": "dom-text" }, { "sSortDataType": "dom-text", "sType": "numeric" }, { "sSortDataType": "dom-text", "sType": "numeric" }, { "sSortDataType": "dom-text", "sType": "numeric"}],
"aoColumns": [null, null, null, null, { "asSorting": ["desc", "asc"]}],
"aoColumns": [{ "sWidth": "450px" }, { "sWidth": "450px" }, { "sWidth": "50px" }, { "sWidth": "50px" }, { "sWidth": "50px"}],
"sPaginationType": "full_numbers"
});
});


I apologise if I have failed to find a solution, but any help would be brilliant.

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    You've got three aoColumns parameters in there which isn't going to help. That would be like having:

    [/code]
    var i=0;
    i=1;
    i=2;
    [/code]
    and expecting i to hold 0, 1 and 2 at the same time :-). You need to combine them into a single statement.

    Beyond that, if that hasn't fixed it can you give us a link to the page with the problem please.

    Allan
  • MaggotMaggot Posts: 2Questions: 0Answers: 0
    Allan, many thanks for the reply. I haver taken on board your comments anbd ammended the code as follows:

    //Set the results table
    oTable = $('#example').dataTable({
    "bProcessing": true,
    "bJQueryUI": true,
    "iDisplayLength": 35,
    "bLengthChange": false,

    "aoColumnDefs": [
    { "asSorting": ["desc", "asc"], "aTargets": [ 4 ] },
    { "sWidth": "450px", "aTargets": [ 0, 1 ] },
    { "sWidth": "50px", "aTargets": [ 2, 3, 4 ] },
    { "sSortDataType": "dom-text", "aTargets": [ 0, 1, 2, 3, 4 ] },
    { "sType": "html", "aTargets": [ 2, 3, 4 ] }
    ],

    "sPaginationType": "full_numbers"
    });

    It still fails to fully execute as before in IE and (as I later found) in Safari. Firefox and Opera are fine.

    Any further help will be appreciated.
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    A like to your example which is not working would be very useful. Also what is the Javascript error (when running the unminified version of DataTables) in IE?

    Allan
  • jmringrosejmringrose Posts: 1Questions: 0Answers: 0
    Just in case anyone still cares about this.

    My experience has shown that every browser, but IE, can deal with an extra comma at the end of an array and IE can't. Whenever I see this kind of message I hunt for one in my config file. 90% of the time it's just that. Most often it's an extra one at the end, just takes some careful reading of the code.

    James
  • brunohassbrunohass Posts: 1Questions: 0Answers: 0
    Hi, you're right jmringrose, after many errors in ie9 i came to this thread and my problem is solved. Never imagined that ie stuck on this.

    Thanks!
This discussion has been closed.