Re-map iTotalRecords value?
Re-map iTotalRecords value?
Deviation
Posts: 2Questions: 0Answers: 0
I'm curious if it's possible to map iTotalRecords to different variable in the JSON response? The web service I call gives the total record count as "event_total" as well as the currently displayed records as "event_count". I searched but couldn't find anything.
If you need sample code, I can provide some. Thanks in advance.
If you need sample code, I can provide some. Thanks in advance.
This discussion has been closed.
Replies
In 1.9- you need to use fnServerData to provide a full Ajax function, with the `success` callback doing the mapping.
Allan
[code]
"fnServerData": function( sSource, aoData, fnCallback ) {
var oSearch = $.ajax({
type: "POST",
dataType: 'json',
url: sSource,
data: aoData
})
.done(function(data) {
console.log("done");
fnCallback(data);
})
.fail(function() {
console.log("error");
});
}
[/code]
"eventList" is my table. I attempted at one point to set the iTotalRecords property in my .done method, but I wasn't sure how to reference the table object.
Thanks.
.done(function(data) {
console.log("done");
var o = {};
o.data = data.myData;
o.draw = data.myDrawCounter;
// ... etc
fnCallback(o);
})
[/code]
Allan