fnServerData - what to do if processing exception?

fnServerData - what to do if processing exception?

jihohanjihohan Posts: 4Questions: 0Answers: 0
edited April 2010 in General
I have the following setup:

[code]
var dataTable = null;
$(document).ready(function() {
dataTable = $("#datatable").dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/RawData/List",
"fnServerData": function(url, data, callback) {
var tablename = $("#tablename").val();
if (tablename != "") {
if (data != null) {
data.push({ "datatable": tablename });
} else {
data = [{ "datatable": tablename}];
}
$.ajax({
"dataType": "json",
"type": "GET",
"url": url,
"data": data,
"success": callback
});
} else {
// what?
}
}
});
$("#tableselector").submit(function() {
dataTable.fnDraw();
return false;
});
});
[/code]

I get the server data on submit, adding the data needed to the url.
The only issue is that if tablename is blank, I get a "processing..." label that does not go away.

I tried returning false, following the standard idiom for events. I tried calling the callback function but it raises an error.

Aside from handling this outside fnServerData, is there anything that can be done within the function?

Replies

  • fastbikefastbike Posts: 14Questions: 0Answers: 0
    See the following thread for one possible solution

    http://datatables.net/forums/comments.php?DiscussionID=1687&page=1
  • jihohanjihohan Posts: 4Questions: 0Answers: 0
    I don't see any comments/solutions on that thread - just the question.

    In any case, the OP's issue seems different than mine. My question is how do I indicate that the fnServerData has finished but with no processing?
This discussion has been closed.