1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00

Internal - refactor processing display

- Simple refactor into the more mordern 'style', only saves about 100
  bytes, but the code looks much cleaner.
This commit is contained in:
Allan Jardine 2013-04-22 09:09:14 +01:00
parent 414abff7e6
commit cdd82a9d0e

View File

@ -2,43 +2,33 @@
/** /**
* Generate the node required for the processing node * Generate the node required for the processing node
* @param {object} oSettings dataTables settings object * @param {object} settings dataTables settings object
* @returns {node} Processing element * @returns {node} Processing element
* @memberof DataTable#oApi * @memberof DataTable#oApi
*/ */
function _fnFeatureHtmlProcessing ( oSettings ) function _fnFeatureHtmlProcessing ( settings )
{ {
var nProcessing = document.createElement( 'div' ); return $('<div/>', {
'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,
if ( !oSettings.aanFeatures.r ) 'class': settings.oClasses.sProcessing
{ } )
nProcessing.id = oSettings.sTableId+'_processing'; .html( settings.oLanguage.sProcessing )
} .insertBefore( settings.nTable )[0];
nProcessing.innerHTML = oSettings.oLanguage.sProcessing;
nProcessing.className = oSettings.oClasses.sProcessing;
oSettings.nTable.parentNode.insertBefore( nProcessing, oSettings.nTable );
return nProcessing;
} }
/** /**
* Display or hide the processing indicator * Display or hide the processing indicator
* @param {object} oSettings dataTables settings object * @param {object} settings dataTables settings object
* @param {bool} bShow Show the processing indicator (true) or not (false) * @param {bool} show Show the processing indicator (true) or not (false)
* @memberof DataTable#oApi * @memberof DataTable#oApi
*/ */
function _fnProcessingDisplay ( oSettings, bShow ) function _fnProcessingDisplay ( settings, show )
{ {
if ( oSettings.oFeatures.bProcessing ) if ( settings.oFeatures.bProcessing ) {
{ $(settings.aanFeatures.r).css( 'visibility', show ? 'visible' : 'hidden' );
var an = oSettings.aanFeatures.r;
for ( var i=0, iLen=an.length ; i<iLen ; i++ )
{
an[i].style.visibility = bShow ? "visible" : "hidden";
}
} }
$(oSettings.oInstance).trigger('processing', [oSettings, bShow]); $(settings.oInstance).trigger('processing', [settings, show]);
} }