Yii 1.1: loading

Simple widget for displaying "loading" icon/splashscreen

You can add this widget to actions & widgets, that do some ajax requests or other continuous javascript operations and use Loading.show() and Loading.hide() for displaying pretty animated loading icon/splashscreen

Don't worry about multiple calls of this widget, it don't write any html excepting registering .js and .css files and in any case it happens once per page.

To customize it's view you can copy assets dir to your_theme_dir/LoginWidget/assets and make it looks differ.

The only sense of moving such simple script to reusable widget is a good code organizing practice and common interface.


Yii framework 1.1+



In views/layouts:


In javascript:


Total 7 comments

#19109 report it
elcedion at 2015/03/19 03:46pm

I made an experiment:

In layout:

Yii::app()->clientScript->registerScript('loading', "
        $('a, button').click(function() {
            return true;

If you use ajax validation in form:

'clientOptions' => array(
        'validateOnSubmit' => true,
        'validateOnChange' => true, 
        'afterValidate'=>'js:function(form, data, hasError) {

So far is working nice (menu, gridview link, submit button).

#16800 report it
Stefano Mtangoo at 2014/03/29 04:25pm
No need for demo

Because its so simple. Put Javascript code on button event or Ajax and you are good to go.

Here is sample (uses Yiistrap but is not hard to understand)

<?php $this->widget('ext.widgets.loading.LoadingWidget'); ?>
         echo TbHtml::submitButton( 'Click Me!',array(
            'onClick'=>'Loading.show(); return false;'
         )); ?>
#7870 report it
bennouna at 2012/04/24 05:56am
An alternative

I like how this extension is non-obtrusive, portable, and DRY. Thanks, I should try it some day.

#7190 report it
Yureshwar Ravuri at 2012/03/02 07:14am
Describe detailed usage of this extension

Can you please elaborate on how to use this extension. Can't figure it out.

#6981 report it
teguh11 at 2012/02/16 10:03pm

how to use this extension?

#6669 report it
Ivan Wilhelm at 2012/01/27 09:26am

Great extension, i use in all my projects!! :D

#5216 report it
sensorario at 2011/09/22 03:23pm
No demo page?

There isn't any demo page =(.

Leave a comment

Please to leave your comment.

Create extension