bProcessing API?
bProcessing API?
Hello,
I was wondering if there was some sort of api for the "Processing..." message. Perhaps a way to pass custom messages to that div and fire it off for user-feedback.
I can, of course, hack something together myself, but I wanted to know if there was anything more clean and built-in. No sense in reinventing things. :-)
Thank you!
-Tim.
I was wondering if there was some sort of api for the "Processing..." message. Perhaps a way to pass custom messages to that div and fire it off for user-feedback.
I can, of course, hack something together myself, but I wanted to know if there was anything more clean and built-in. No sense in reinventing things. :-)
Thank you!
-Tim.
This discussion has been closed.
Replies
Allan
From what I read in other posts, there isn't a way to change the value of sProcessing after dataTable init, so what I did (after using the above method) is directly changed the innerHTML of the div, displayed the custom message, hid the message, and changed it back to "Processing...", like so:
Plugin:
[code]
$.fn.dataTableExt.oApi.fnProcessingIndicator = function ( oSettings, onoff )
{
if( typeof(onoff) == 'undefined' )
{
onoff=true;
}
this.oApi._fnProcessingDisplay( oSettings, onoff );
};
[/code]
Custom message method:
[code]
function notify(msg){
var msgSpot = $('.dataTables_processing');
// Default value if none is specified
msg = typeof(msg) == 'undefined' ? 'Processing...' : msg;
// Replace the text in the nofication area with the specified text, and make it visible
$(msgSpot).html(msg);
oTable.fnProcessingIndicator();
// After 2 seconds, hide the notice, and put it back the way we found it
setTimeout(function(){
oTable.fnProcessingIndicator(false);
$(msgSpot).html('Processing...');
}, 2000);
}
[/code]