busy
When starting ajax calls from a Smartlet, you can make SCF automatically display a 'busy' dialog, or let SCF call a function pointer when the ajax call starts and ends.
The simplest scenario is to let SCF handle everything. To do this, simply pass the boolean value 'true' to the busy property. This will make SCF position a busy dialog over the Smartlet's outer div (or the html element that has the smartlet id):
Javascript | Copy Code |
---|---|
sml.ajax({ busy: true, ready: function(){ alert("Ready"); } }); |
Alternatively, you can pass the id of an element, a DOM element, or a jQuery selector object to the busy property. This will result in the SCF busy dialog to be centered over the given element.
Javascript | Copy Code |
---|---|
sml.ajax({ busy: $j("#main-content"), ready: function(){ alert("Ready"); } }); |
In iXperion 1.3+, you can also pass a settings object to the busy property. This settings property can contain the following options:
- delay: Number
Time in milliseconds before the busy window is shown (default=1000, 0=no delay) - fadeInTime: Number
Time in milliseconds to fade in the busy dialog (default: 100, 0=no fade) - fadeOutTime: Number
Time in milliseconds to fade out the busy dialog (default: 100, 0=no fade)
Javascript | Copy Code |
---|---|
sml.ajax({ busy: {delay: 500}, ready: function(){ alert("Ready"); } }); |
Finally, you can pass a handler to be called:
Javascript | Copy Code |
---|---|
sml.ajax({ busy: function(mode){ if(mode==false) alert("Smartlet no longer busy."); else alert("Smartlet now busy."); }, ready: function(){ alert("Smartlet ajax call ready."); } }); |
Note:
The standard SCF Ajax busy indicator is implemented as a div HTML element with a CSS class ScfAjaxBusySmall. The /Scf/jQuery/Behavior/Styles/Scf.Basics.css file does the default styling, but you can overrule it using your site css.