ContentPane: the widget you absolutely must/have to know about Dojo
I've been using Dojo Javascript toolkit(version 0.3.1) for a while to develop AJAX web applications.
My experience so far indicates that ContentPane is the most important widget in Dojo which you should absolutely need to learn about when you start using Dojo.
One of the very basic usages in AJAX is to load content from remote servers without refreshing the whole page.
ContentPane provides all the nice features to do that:
- load content by setting the innnerHTML of the pane through function setContent
- load content from a URL through setURL
- eval Javarscripts loaded in the pane by setting executeScripts to 'true'. This is very useful as it's very likely that you have some Javascripts included with the remote contents you are loading. Note that the inlined local variables(eg. this.abc)/functions(this.funcName) from the remote content are not accessible
- use setting cacheContent to "false" to enforece that no cached content from browsers(this is important as you don't want to show stale data in your dynamic application)
- add listeners for onDownload*, onLoad and onUnLoad events(eg: you can't access a page element until the content is "loaded", so you need to listen to "onLoad" event using addOnLoad or dojo.event.connect)
With all these nice features, no wonder that ContentPane is the base class for many Dojo HTML widgets.
If you are not using ContentPane with Dojo, you are not really using Dojo.
Tags: dojo ajax javascript











