bProcessing - what am I missing?
bProcessing - what am I missing?
I am trying to add bProcessing to my code, but it does not appear to be working. Here is my code. I saw something about a css entry for the table, but did not understand what it was referring to. It implied something like this:
#assignment_table_processing
{ background-color: #FF0000; }
[code]
jQuery(document).ready( function () {
var oTable = jQuery('#assignment_table').dataTable({
"bProcessing": true,
"bStateSave": true,
"oLanguage": {
"sZeroRecords": "No results"
},
"fnDrawCallback": function ( oSettings ) {
/* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered )
{
for ( var i=0, iLen=oSettings.aiDisplay.length ; i,
"iDisplayLength": <%=itemsPerPage%>,
"sDom": 'iplrtp<"clear">',
"sPaginationType": "full_numbers",
"aaSorting": [[ <%=sortColumn%>, "<%=sortDirection%>" ]],
"aoColumnDefs": [
{"bSortable": false, "aTargets": [0,1,2,3,4]},
{"sType": "uniDate", "aTargets": ["date"]},
{"sType": "html", "aTargets": ["htmldiv"]},
{"sType": "numeric", "aTargets": ["number"]}
],
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({"name": "layout", "value": "<%=plLayout%>" });
aoData.push({"name": "status", "value": "<%=plStatus%>" });
aoData.push({"name": "cabinet", "value": "<%=plCabinet%>" });
aoData.push({"name": "upload", "value": "<%=plUpload%>" });
aoData.push({"name": "analyst", "value": "<%=plAnalyst%>" });
aoData.push({"name": "work", "value": "<%=plWork%>" });
aoData.push({"name": "column", "value": "<%=plColumn%>" });
aoData.push({"name": "operator", "value": "<%=plOperator%>" });
aoData.push({"name": "criteria", "value": "<%=plCriteria%>" });
aoData.push({"name": "includeAll", "value": "<%=plInclude%>" });
aoData.push({"name": "isAnalyst", "value": "<%=isAnalyst%>" });
aoData.push({"name": "userId", "value": "<%=userIdi%>" });
aoData.push({"name": "userDeptId", "value": "<%=userDeptIdi%>" });
jQuery.ajax({
"dataType": "json",
"type": "POST",
"url": sSource,
"data": aoData,
error: function (jqXHR, textStatus, errorThrown) {
ajaxFailedFunctionToCall = null
//jQuery("#assignment_table_processing").css({visibility: "hidden"});;
alert(jqXHR.status+','+textStatus+','+errorThrown);
},
success: function(data) {
if(data.exportLocation != undefined) {
window.location = data.exportLocation;
}
fnCallback(data);
}
})
}
});
new FixedHeader( oTable, { "zTop": "10" });
// these oSettings lines prevent the initial ajax call, but allow rest of calls to user ajax.
oSettings = oTable.fnSettings();
oSettings.oFeatures.bServerSide = <%=callDbUsingAjax%>;
oSettings.oFeatures.bProcessing = true;
oSettings.sAjaxSource = "/admin/ajax.jsp?action=assignListSort";
});
[/code]
#assignment_table_processing
{ background-color: #FF0000; }
[code]
jQuery(document).ready( function () {
var oTable = jQuery('#assignment_table').dataTable({
"bProcessing": true,
"bStateSave": true,
"oLanguage": {
"sZeroRecords": "No results"
},
"fnDrawCallback": function ( oSettings ) {
/* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered )
{
for ( var i=0, iLen=oSettings.aiDisplay.length ; i,
"iDisplayLength": <%=itemsPerPage%>,
"sDom": 'iplrtp<"clear">',
"sPaginationType": "full_numbers",
"aaSorting": [[ <%=sortColumn%>, "<%=sortDirection%>" ]],
"aoColumnDefs": [
{"bSortable": false, "aTargets": [0,1,2,3,4]},
{"sType": "uniDate", "aTargets": ["date"]},
{"sType": "html", "aTargets": ["htmldiv"]},
{"sType": "numeric", "aTargets": ["number"]}
],
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({"name": "layout", "value": "<%=plLayout%>" });
aoData.push({"name": "status", "value": "<%=plStatus%>" });
aoData.push({"name": "cabinet", "value": "<%=plCabinet%>" });
aoData.push({"name": "upload", "value": "<%=plUpload%>" });
aoData.push({"name": "analyst", "value": "<%=plAnalyst%>" });
aoData.push({"name": "work", "value": "<%=plWork%>" });
aoData.push({"name": "column", "value": "<%=plColumn%>" });
aoData.push({"name": "operator", "value": "<%=plOperator%>" });
aoData.push({"name": "criteria", "value": "<%=plCriteria%>" });
aoData.push({"name": "includeAll", "value": "<%=plInclude%>" });
aoData.push({"name": "isAnalyst", "value": "<%=isAnalyst%>" });
aoData.push({"name": "userId", "value": "<%=userIdi%>" });
aoData.push({"name": "userDeptId", "value": "<%=userDeptIdi%>" });
jQuery.ajax({
"dataType": "json",
"type": "POST",
"url": sSource,
"data": aoData,
error: function (jqXHR, textStatus, errorThrown) {
ajaxFailedFunctionToCall = null
//jQuery("#assignment_table_processing").css({visibility: "hidden"});;
alert(jqXHR.status+','+textStatus+','+errorThrown);
},
success: function(data) {
if(data.exportLocation != undefined) {
window.location = data.exportLocation;
}
fnCallback(data);
}
})
}
});
new FixedHeader( oTable, { "zTop": "10" });
// these oSettings lines prevent the initial ajax call, but allow rest of calls to user ajax.
oSettings = oTable.fnSettings();
oSettings.oFeatures.bServerSide = <%=callDbUsingAjax%>;
oSettings.oFeatures.bProcessing = true;
oSettings.sAjaxSource = "/admin/ajax.jsp?action=assignListSort";
});
[/code]
This discussion has been closed.
Replies
Allan
What I am asking is are there other flags, other pieces - like the css - that jump out as being needed.
I get the data on open of the page, so I do not want to call the ajax on the document.ready. If the resulting rows returned are not enough to need to revisit the database, i do not want to call the ajax either. I am using callDbUsingAjax as a boolean to determine if we want to make the ajax call and do the serverside processing.
Not that I see. You could try adding a little bit of debug code to DataTables to check that it is being made visible: _fnProcessingDisplay is the inter nation function where you would want to add a bit of debug.
Allan