fnDraw() does Ajax Call but no refresh on page
fnDraw() does Ajax Call but no refresh on page
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
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
This discussion has been closed.
Replies
Bad coding on my side. So all others keep in mind: sEcho is quite important to get right.
Marc