I’ve played around with Dojo in the past but my primary Javascript framework has always been either Prototype or MooTools. In both cases they have some really useful functions built into them. One of the best in MooTools is the $ function which has been extended to allow you to select pretty much anything in your HTML without having to do lots of nested loops. So for example if I have some HTML like this (because, of course, we shouldn’t use non-unique ids on HTML elements, should we):
<ul id="movies">
<li class="sortme">
<div class="movie">
Gross Point Blank
</div>
</li>
<li class="sortme">
<div class="movie">
Casino Royale
</div>
</li>
</ul>
Then I could use the following line to select all of the divs that have the CSS class “movie” applied to them:
var list = $('movies').getElements('div.movie');
But how do you do the same in Dojo? Well of course it’s simple, just need some different syntax. So for the same HTML as before, we would use dojo.query tool like this:
dojo.query("div.movie");
For more detail, check out the Book of Dojo chapter on selecting dom nodes with dojo.query
Hi Rob,
Yes Dojo 1.1.1 is included with Domono 8.5 and XPages generates a large amount of code that uses Dojo behind the scenes. Depending on your requirements you can let Domino and Dojo do their thing and not get involved, but if you want to add extra functionality to your website then using Dojo is pretty much required.
There isn’t a huge amount of documentation… yet. As time goes on IBM and the blogging community will add more, but for the moment, your best bets for a starting point are dojonimo.com and the Domino Designer Wiki.
Matt
Oops thanks Martijn, yet more proof that I shouldn’t post when I come home from the pub of an evening
http://www.11tmr.com/11tmr.nsf/emoticons/DLYH-5MZVLY/$File/smile.gif“ />