Wednesday, May 17th, 2006

Dojo HelloWorld Tutorial

Category: Articles, Dojo, Examples, Library

A common complaint issued against Dojo is the lack of quality documentation, particularily as development moves so quickly and old docs become out of date. While there is some work going on to add inline “javadoc” style docs to the code, there is a new HelloWorld article available, written by Lance Duivenbode. It walks through Dojo’s event, IO, and widget systems.

Lets hope its a first step in a series of more in hands-on articles for Dojo.

Posted by Rob Sanheim at 10:30 am

3.5 rating from 140 votes


Comments feed TrackBack URI

Good to see some Dojo docs.

I hate to bring up the Dojo Doco issue again, but after seeing Alex’s talk last week, I now realise there’s another audience for which the doco is critical. Not end-developers, but toolkit/library manufacturers. There’s a lot of potential in Dojo’s packaging as a de facto industry standard, but toolkit manufacturers need a clear message in order to incorporate it into their own products.

If I understand correctly, a product like Mochikit – which does take advantage of Dojo packaging – can still be used completely independently of Dojo and without any interference. Furthermore, the overhead of including the Dojo bootstrap etc is only 5kb of compressed Javascript, so the performance is almost always going to better than pulling down several separate, uncompressed, JS files for a given library.

Comment by Michael Mahemoff — May 17, 2006

re: tests

The new dojo web site at has a very nice interface for the tests.

Comment by Torrey — May 17, 2006

I tried to try some demos on, but they completely hang my IE (100% CPU ad infinitum). Don’t tell me they didn’t test these demos in IE?

I believe in Dojo, much, much more than in those other libraries whose name I try to avoid. And Alex seems very intelligent, judging from his talks.

But I can’t understand why they would publish something that doesn’t work. (tested at a collegues machine as well).

Comment by Lon — May 18, 2006

I’ve just had similar experiences in IE.

Comment by Ulrik Bo Larsen — May 18, 2006

nearly 200Kb of javascript for a crappy button and a simple xmlhttprequest is just daft.

Comment by davros — May 18, 2006

My IE 6.0 also hangs ad infinitum when calling for any “View Demo” from “see it in action” tab on new 3.0 powered site. Shame on Dojo to release such erroneous behavior.

Comment by Krzysztof — May 18, 2006

We’re looking into it. It works with some versions of IE 6, and crashes other versions of IE 6… lots of fun.

Obviously it’s not just a button, but demos of all of the widgets in dojo. We’ll get it licked asap.

Comment by Dylan Schiemann — May 18, 2006

My version of IE is 6.0.2900.2180.xpsp_sp2_gdr.050301-1519.
(The same I’ve found reported on Dojo-interest).
Operating System: Microsoft Windows XP
Windows version: 5.1
Build number: 2600 Service Pack 2


Comment by Krzysztof — May 19, 2006

Things seem to be worse than I thought.
1. Each time I resize IE6 window with (with default “news & announcements” tab active), browser reloads picture (as I can see from messages in status line – BTW unaccessible by “access denied” when typed directly into URL).
2. After activating “see it in action” tab, and just hovering thru buttons below Categories, the same picture is tried to be downloaded as long as mouse pointer scans thru buttons. This is weird.
3. After resizing browser window, all buttons below “Categories” title DISAPPEAR.
Hope my observation will be helpful.

Comment by Krzysztof — May 19, 2006

From the article: “Using document.getElementById will not work since the DOM has been modified by Dojo.

I guess it loses points because this is clearly not “Unobtrusive Javascript.” I mean, hell, it modifies the DOM? Apparently I’d have to either commit to Dojo 100% or I can’t use it at all. I clearly can’t use it in conjunction with all the other code I’ve written, since the code I write relies heavily on getElementById()

Comment by Lawrence Krubner — May 21, 2006

Currently, I cannot reproduce issues 1. and 2. mentioned earlier in my post. Issue 3 (and “of course” hanging IE after calling demo) still remain.

Comment by Krzysztof — May 22, 2006

I can’t even get to the page to read the Hello World article. With all due respect, I think the brilliant developers of Dojo are in serious need of Product Manager that’s been around the development block a few times.

I was on the path to using Dojo and DWR but now I am having serious second thoughts.

Comment by John Justin — May 23, 2006

It is nice to see that all my issues reported earlier regarding IE hanging and other suspicious behavior, now disappeared.
The whole Dojo demo looks nice and great.

Comment by Krzysztof — May 25, 2006

“Using document.getElementById will not work since the DOM has been modified by Dojo. ”

I believe what he’s referring to is that the dojo button cannot be found with getElementById(), but I’m certain everything “non-dojo” can be. So your scripts should still work unless you try referring to the dojo widgets without using the dojo functions (why would anyone do that?)


Comment by Sandra — June 13, 2006

Utterly at a loss. I’ve copied the code exactly after failing to get my own example working. Even when copying the code exactly it fails to work. No debug output, no javascript errors – it just doesn’t give an alert box in ANY browser.

I’m sick to the back teeth with Dojo. I’ve been trying for the past 2 months to work with it and the confusing and incomplete documentation hasn’t helped at all. Whats worse is when you DO use a ‘good’ article and go to the extent of copying it entirely – it still fails with no explanation whatsoever.

I’m using Prototype.

Comment by Doug — July 19, 2006

@Doug: Same experience here…

Comment by dave — August 2, 2006

In fact I was trying to launch dojo-0.3.1-Ajax on my development server
win xp sp2, apache 2.0.54, mod_rewrite, php5, mysql5.

I was unable to run it…I’ve got “Fatal: Unable to load modules” error in both FireFox & OPERA browsers.

After that I have downloaded 0.3.0-Ajax and installed it. It works correctly.

The problem is that there is no documentation available and pieces of code available in the internet from site to site doesn’t make much sense. Very uncomfortable with that, as working with dojo REQUIRES to debug the code, change templates & css code and always ALWAYS guess WHAT AND HOW IT’S PROBABLE IMPLEMENTED.


Comment by Dmitry Semenov — August 3, 2006

Well… This tutorial doesn’t work.
There are 2 errors in the code :
1 ) The event “connected” to the helloPressed function is onclick not onClick (surprising mistake from a javascript library coder…)
2 ) It’s not actually an error but you can write both
“dojo.event.connect(helloButton, ‘onClick’, ‘helloPressed’)” and
“dojo.event.connect(helloButton, ‘onClick’, dj_config, ‘helloPressed’)”
Don’t ask me why…

“Using document.getElementById will not work”
Actually, it works … (of course you have to add the id attribute)
Maybe this tutorial is out of date, hopefully it will be fixed soon

“I’m using Prototype.”
I wish my company chose Prototype… :)

Comment by Max — October 11, 2006

Well well …
You must use dojo.byId(“helloPressed”) instead of dojo.widget.byId(“helloPressed”)…
That’s not a satisfying solution because it returns the DOM Element, not the dojo widget. But they do it that way in the test files.

Comment by Max — October 11, 2006


Comment by sudhir — April 23, 2007

I had searched a lot over net to find a running example on Ajax and DOJO tutorial together, but could not find. Then I developed one tutorial on the same and sharing with you.


Binod Suman

Comment by BinodSuman — April 26, 2009

One simple example on Dojo.


Binod Suman

Comment by BinodSuman — April 26, 2009

Leave a comment

You must be logged in to post a comment.