Returning early from fnServerData "Loading..." indicator remains visible
Returning early from fnServerData "Loading..." indicator remains visible
robertbrower
Posts: 158Questions: 1Answers: 0
I'm using 2 data tables in a master-details arrangement where when the user clicks on a row in the master data table, the details data table is reloaded using info from the row that was clicked in the master data table. Both data tables use server side processing.
Here is the fnServerData option for the details data table. I am returning early if there is nothing selected in the master data table. But when i do the "Loading..." indicator is left visible.
Is there a way to prevent this? If I could just do away with the "Loading..." indicator that would be a suitable solution because I already have an ajax loading indicator for the entire page.
Thanks.
Robert
Link to example: http://jsfiddle.net/atomofthought/2Y8SC/
[code]
$(document).ready(function() {
$('#example').dataTable({
"sPaginationType": "full_numbers"
, "sAjaxSource": "ThisWillNeverBeUsedInThisExample"
, "fnServerData": function (sSource, aoData, fnCallback) {
if (nothingSelected == undefined) {
return;
}
// I'd normally call $.ajax() here...
}
});
});
}
[/code]
Here is the fnServerData option for the details data table. I am returning early if there is nothing selected in the master data table. But when i do the "Loading..." indicator is left visible.
Is there a way to prevent this? If I could just do away with the "Loading..." indicator that would be a suitable solution because I already have an ajax loading indicator for the entire page.
Thanks.
Robert
Link to example: http://jsfiddle.net/atomofthought/2Y8SC/
[code]
$(document).ready(function() {
$('#example').dataTable({
"sPaginationType": "full_numbers"
, "sAjaxSource": "ThisWillNeverBeUsedInThisExample"
, "fnServerData": function (sSource, aoData, fnCallback) {
if (nothingSelected == undefined) {
return;
}
// I'd normally call $.ajax() here...
}
});
});
}
[/code]
This discussion has been closed.
Replies
Perhaps I should add the ability to return `false` from the function...
Allan
I think you are right. Adding the ability to return false would be good in this situation.
Thanks Allen.
call fnCallback like this and return...
fnCallback({
aaData: []
, iTotalDisplayRecords: 0
, iTotalRecords: 0
, sColumns: null
, sEcho: "0"
});
return;
Oops! Yes. That's the one :-). First argument to _fnProcessing display is the settings object and the second a boolean.
Allan