fnDraw() does Ajax Call but no refresh on page

fnDraw() does Ajax Call but no refresh on page

logeloge Posts: 15Questions: 1Answers: 0
edited October 2013 in General
Hi,

i have a weird issue. I am using bServerSide: true on my table depending on other components of the page, i will use a different URL within my fnServerData callback.

It looks like this:

[code]
"fnServerData": function (sSource, aoData, fnCallback, oSettings) {

var sSourceNew = sSource;
var dataInSelect = $("#s2").select2("data");
if(machineIdSelected == -1) {
if(dataInSelect.length == 0) {
sSourceNew = "someUrl/yeahyeahNew";
}
}

oSettings.jqXHR = $.ajax({
"dataType": 'json',
"type": "GET",
"contentType": "application/json+tablemodel",
"url": sSourceNew,
"data": aoData,
"success": function(data) {
fnCallback(data);
}
});
[/code]

So when component "select2" changes i call a fnDraw() on my table which in turn makes an AJAX call via fnServerData. Everything fine. I get a new set of data and all is fine. BUT the table just stays with the old dataset.

So even everything looks good (the second AJAX call with my new URL was being made), i dont get the results reflected in my table (visually).

I am clueless. I assume that fnCallback(data) should do the trick. Also: fnDrawCallback will not be called after the fnDraw() call. This doesnt seem right either.

Thx for any pointers.

Marc

Replies

  • logeloge Posts: 15Questions: 1Answers: 0
    Please forget my issue. The problem is not that fnDraw() doesnt redraw. its the fact that i returned a wrong sEcho from Server. DataTable cant sync data to my particular table, if i return a wrong sEcho in the AJAX response of course.....

    Bad coding on my side. So all others keep in mind: sEcho is quite important to get right.

    Marc
This discussion has been closed.