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.
Requirements ¶
Yii framework 1.1+
JQuery
Usage ¶
In views/layouts:
$this->widget('ext.widgets.loading.LoadingWidget');
In javascript: ~~~ [javascript] Loading.show(); Loading.hide(); ~~~
No demo page?
There isn't any demo page =(.
Great
Great extension, i use in all my projects!!
:D
use
how to use this extension?
Describe detailed usage of this extension
Can you please elaborate on how to use this extension. Can't figure it out.
An alternative
I like how this extension is non-obtrusive, portable, and DRY. Thanks, I should try it some day.
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'); ?> <?php echo TbHtml::submitButton( 'Click Me!',array( 'color'=>TbHtml::BUTTON_COLOR_DEFAULT, 'size'=>TbHtml::BUTTON_SIZE_DEFAULT, 'onClick'=>'Loading.show(); return false;' )); ?>
Nice
I made an experiment:
In layout:
$('a, button').click(function() { event.stopPropagation(); Loading.show(); return true; }); ");
If you use ajax validation in form:
So far is working nice (menu, gridview link, submit button).
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.