Yii 1.1: jbusy

JBusy extension, javascript utility to show or hide animated activity / busyness indicator
5 followers

This extension is a yii wrapper to use easily the jbusy plugin.

It provides an easy way to show / hide an image instead of an html element (mainly used with ajax to show activity during data transfer).

jbusy image

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions

Usage

See the following code example:

Yii::import('ext.jbusy.JBusy');
 
// create the busy object
$busy = new JBusy();
 
// create an ajax request array based on a jquery selector or a widget instance
// this will create beforeSend and complete javascript function to pass to $.ajax.
$ar = $busy->createAjaxArray('#plot1');
 
// merge with your options
$ajax = array_merge($ar, array(
    'url' => 'my_data.php',
    'success' => 'js:function() { alert("well done."); }',
    'error' => 'js:function() { alert("an error occured."); }'
));
 
// register the ajax script
Yii::app()->clientScript->registerScript('ajax1', '$.ajax('.CJavaScript::encode($ajax).')');

With this code, the html element with id plot1 will be replaced by an animated image during the retrieving of my_data.php file.

Change Log

September 16, 2010

  • Initial release.

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads