Oh my god. It's full of code!

Visualforce Animated ActionStatus Loading Bar

Hey everyone.
This might be old news or easy to figure out for some developers but it took me a bit to figure out so I thought I’d share. If you have a visualforce page and are making use of the actionStatus ajax functionality to display loading messages you might want to include an image instead of just text. The way to do this is to assign a CSS style to the loader with the background image and a few extra attributes.

It turns out that actionStatus loader is actually a span, so you need to do a few things to get it to respond to width and height assignments in the CSS. Specifically you have to float it. Here is my example.

               
 .loader
                {
                    background-image:url('http://blogs.nvidia.com/wp-content/themes/nvidia/images/ajax-bar.gif');
                    background-position:right top;
                    width:280px;
                    height:23px;
                    margin-left:15px;
                    font-size:14px;
                    padding:0px;
                    float:left;
                    background-repeat:no-repeat;
                    
                }

Then for your action status just assign that css class as the styleClass.

Of course you can change the text to whatever you like and ajust the width and height attributes to match your loading image.

Anyway hope this helps someone out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s