fnServerData not called in IE8

fnServerData not called in IE8

severinseverin Posts: 11Questions: 0Answers: 0
edited January 2012 in DataTables 1.8
Hi, i'm currently running into a very strange behaviour. This is my Code:

[code]
$("#mit_konto_nichtgen_4").dataTable({
"bPaginate" : false
, "bLengthChange" : false
, "bJQueryUI" : true
, "bServerSide" : true
, "sAjaxSource" : 'anm_getMITKonto_ajax.php'
, "oLanguage": {"sUrl": './de_DE.txt'}
, "bProcessing": true
, "bAutoWidth": false
, "bSort": false
, "sDom": 'rt'
, "bStateSave": false
, "fnDrawCallback": function() {
$("#ft_mit_konto_nichtgen_4").remove();
}
, "fnFooterCallback": function(nRow, aaData, iStart, iEnd, aiDisplay ) {
var nCells = nRow.getElementsByTagName('th');
if (aaData.length > 0){
nCells[0].innerHTML=aaData[(aaData.length)-1][0]
nCells[2].innerHTML=aaData[(aaData.length)-1][1]
nCells[4].innerHTML=aaData[(aaData.length)-1][2]
}
}
, "fnServerData": function ( sSource, aoData, fnCallback ) {
alert("fnServerdataTest");
aoData.push({"name": "MIT_ID", "value": "1791"});
aoData.push({"name": "STS_IDs[]", "value": "5"});
aoData.push({"name": "STS_IDs[]", "value": "6"});
aoData.push({"name": "STS_IDs[]", "value": "7"});
aoData.push({"name": "STS_IDs[]", "value": "8"});
aoData.push({"name": "DT_ID", "value": "mit_konto_nichtgen_4"});
aoData.push({"name": "PRD_IDs[]", "value": "4"});
aoData.push({"name": "PRD_IDs[]", "value": "3"});
aoData.push({"name": "PRD_IDs[]", "value": "2"});
var myData=$.ajax({
"dataType": 'json'
,"type": "GET"
,"url": sSource
,"data": aoData
, "success": function(data){
fnCallback(data);
}
});
}
});
});
[/code]

when i use it in Firefox everything works like it should. The Table is styled with the jqueryui-styles, the alert("fnServerdataTest") pops up, and the table gets filled with the data.
In IE8 however, the table is styled with the jqueryui-styles and then nothing happens. no alert-box, no data in the table. Does anyone have any idea what might be causing this?

thanks in advance
severin

Replies

  • severinseverin Posts: 11Questions: 0Answers: 0
    OK, the problem seems to be connected to setting oLanguage. if i don't set it, it works as it should. but if i set it, it doesn't, even if i remove all the callbacks from initialization.
  • severinseverin Posts: 11Questions: 0Answers: 0
    I fixed this for me with using a function to return the localized oLanguage-Object instead of loading it using sUrl. One thread on here seems to be suggesting that the validation-plugin might be to blame, but since i'm using the latest version and the same combination in another project without problems i think it must be something else...i'd still be interested in the cause if someone knows it though.
  • allanallan Posts: 61,864Questions: 1Answers: 10,136 Site admin
    Very odd! Were you only running into this problem in IE8? Was it reproducible in other browsers at all?

    Allan
  • allanallan Posts: 61,864Questions: 1Answers: 10,136 Site admin
    Looking at your code - one thing I would say (other than this shouldn't be happening!) is that you can use fnServerParams (DataTables 1.8.2+) to do what you are using fnServerData for, but easier since you don't need to define your own $.ajax() call.

    Allan
  • severinseverin Posts: 11Questions: 0Answers: 0
    Thanks for the suggestion of fnServerParams, i will look into that. So far i've only tested this in Firefox 9.0.1, where it worked, and IE8 where it didn't. I'll see if i can test it in other browsers as well and will let you know.
  • severinseverin Posts: 11Questions: 0Answers: 0
    ok, i tested it in IE7 (same Problem as IE 8) and chrome (worked). i'm stumped, especially since i use the exact same setup on another project and there it works. if someone wants to try and replicate/solve this: js loaded in this order:

    jquery 1.6.1
    jquery-ui 1.8.13
    jquery-ui-datepicker

    datatables 1.8.1
    jquery.cookie
    jquery.validate 1.9.0 (no localization)

    here's the language-file:
    [code]
    {
    "sProcessing": "Daten werden geladen...",
    "sLengthMenu": "_MENU_ Einträge anzeigen",
    "sZeroRecords": "Keine Daten gefunden.",
    "sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
    "sInfoEmpty": "0 bis 0 von 0 Einträgen",
    "sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
    "sInfoPostFix": "",
    "sSearch": " Suchen:",
    "sUrl": "",
    "oPaginate": {
    "sFirst": "Erster",
    "sPrevious": "Zurück",
    "sNext": "Nächster",
    "sLast": "Letzter"
    }
    }
    [/code]

    if i ever find the time, perhaps i'll look deeper into this, but for now i have my solution with the function...
  • allanallan Posts: 61,864Questions: 1Answers: 10,136 Site admin
    Cool - thanks very much for the feedback. I'll look into it myself at some point soon, but good to hear that there is a good workaround!

    Allan
This discussion has been closed.