DataTables 1.9.0 - Setting Defaults - Not working in IE8 and below

DataTables 1.9.0 - Setting Defaults - Not working in IE8 and below

sanelsonsanelson Posts: 12Questions: 0Answers: 0
edited February 2012 in Bug reports
I just downloaded the 1.9.0 release and decided to try give the defaults a spin, which is a great feature, BTW. It works great in IE9, Chrome, and Firefox, but in IE8 (can also be reproduced in IE9 running in IE8 mode or compatibility mode).

Here's my code, if it helps.

This function is being run when the page loads.
[code]
$(document).ready(function () {
// Set DataTable defaults
$.extend($.fn.dataTable.defaults, {
"bJQueryUI": true
,"sPaginationType": "full_numbers"
,"sDom": '<"H"<"toolbar"><"title">fr>t<"F"lip>'
,"sScrollX": "100%"
,"bScrollCollapse": true
,"bAutoWidth" : false
,"fnInitComplete": function(oSettings, json) {
var title = $(this).attr("data-title");
if (title) {
$(this).parents(".dataTables_wrapper").find(".title").text(title);
}
}
});
});
[/code]

I'm using AJAX to load a table and then run the following script directly afterwards
[code]
$('#user-datatable').dataTable({
'aoColumns': [
null
,{'asSorting': []}
,null
,null
,null
,null
,null
,null
,null
,null
,null
]
});
[/code]

In modern browsers this works great, but in IE <= 8 none of the defaults are getting set. If I change the dataTable call where I'm actually creating the table to include the defaults, then it works in IE8.

Replies

  • sanelsonsanelson Posts: 12Questions: 0Answers: 0
    Bump.

    No comments, and I haven't seen anyone else report this issue. Has anyone else noticed this, or am I just doing something totally wrong?

    Thanks.
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Ive just tried to reproduce this with my zero config example set to:

    [code]
    // Set DataTable defaults
    $.extend($.fn.dataTable.defaults, {
    "bJQueryUI": true
    ,"sPaginationType": "full_numbers"
    ,"sDom": '<"H"<"toolbar"><"title">fr>t<"F"lip>'
    ,"sScrollX": "100%"
    ,"bScrollCollapse": true
    ,"bAutoWidth" : false
    ,"fnInitComplete": function(oSettings, json) {
    var title = $(this).attr("data-title");
    if (title) {
    $(this).parents(".dataTables_wrapper").find(".title").text(title);
    }
    }
    });


    $(document).ready(function() {
    $('#example').dataTable();
    } );
    [/code]

    but the defaults are being applied in IE7+.

    Can you link me to a test case where it isn't working please?

    Allan
  • sanelsonsanelson Posts: 12Questions: 0Answers: 0
    Hmm, well I was trying to make a demo simulating creating a table by AJAX, and I couldn't reproduce the issue. I went back in my app and changed it to use the defaults again, and it seems to be working now (in IE9 running in IE7/8 mode anyway). I don't know if it was a caching issue or a JS error. I'll post back if anything changes. But in the meantime, thanks for looking into it, and sorry for wasting your time. This is a great plugin, by the way.
This discussion has been closed.