ProgressBar
The ProgressBar dijit behaves
just like any other progress bar you've seen in an application, and it
comes in both determinate and indeterminate variations. One of the
greatest things about it is that there's just not that much to say. In
fact, Example 15-3 should do a
good job of speaking for itself.
Example 15-3. Typical indeterminate ProgressBar usage
<div dojoType="dijit.ProgressBar" indeterminate="true" style="width:300px"></div>
Of course, there will certainly be times when you'll want to fetch a real update from the server and display actual progress instead of an indeterminate indicator. Let's assume that you have a server-side routine that is returning some kind of progress indication. The following mockup simulates:
import cherrypy
config = {
#serve up this static file...
'/foo.html' :
{
'tools.staticfile.on' : True,
'tools.staticfile.filename' : '/absolute/path/to/foo.html'
}
}
class Content:
def _ _init_ _(self):
self.progress = 0
@cherrypy.expose
def getProgress(self):
self.progress += 10
return str(self.progress)
cherrypy.quickstart(Content( ), '/', config=config)The file foo.html that contains the
ProgressBar might look like
this:
<html> <head> <title>Fun with ProgressBar!</title> <link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.1/dojo/resources/dojo.css" /> <link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.1/dijit/themes/tundra/tundra.css" /> <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access