Learning Dojo


Author(s): Peter Svensson
ISBN: 1847192688
Published: November 2008
Relevance: 4/5
Readability: 4/5
Overall: 4/5

More Packt Publishing Books Reviews …

This book is presented us in how to work with Dojo with a special style, you would consider this book pretty good how quickly reference in your hands.

This Book is available here

The scalable learning approach applied throughout eight well chapters is practically independents among them

  • Chapter 1: Introduction to Dojo
  • Chapter 2: Useful JavaScript and Dojo Tricks
  • Chapter 3: Basic Dijit Knowledge
  • Chapter 4: Ajax Communication
  • Chapter 5: Forms
  • Chapter 6: Layout
  • Chapter 7: Data, Trees, and Grids
  • Chapter 8: Real-World Dojo

Chapter 01 – Introduction To Dojo

This is really a fast chapter, not about amount of pages, instead in the sentide that has concrete theory and code sample some advanced, the chapter start with "Dojo usage" teaching us for instance the specific functions in the web for Dojo and its functionalities (like JSON encoding, Ajax Support, Memory Leak protection, among others).

The first example is a "Dynamic Charting", its has a graphic sample and the source code is explained in a superficial way, but understandable, therefore, basic/medium knowledge for Javascript (arrays, methods…) and DOM is assumed.

After that the second sample introduced is a "StackContainer Wizard", three images using some dijit objects(ColorPalette,Editor,Calendar) and its source code (little long) explained in superficial way (again some Javascript,DOM and even Dojo is assumed).

The purpose of these samples is show to the reader some capabilites of dojo, thats the reason that deeper explanation doesn’t exists.

Then a good explanation about what is dojo and what not, is teaches us, furthermore the content directories in Dojo distribution
(dojo,dijit,dojox,util) is explained

An interesting table in four pages for dojo features with a concrete explanation for each one is offered like (Object Orientation, dojo.data, Debugging, Encoding, XML, Parsing, among others)

To end the chapter a comparison for Dojo among other frameworks (Prototype, JQuery, YUI, EXT) is well cover in a concrete way.

Chapter 02 – Useful JavaScript and Dojo Tricks

This chapter start with some snippet about how write code in many equivalent ways, for instance

var box = {};
box.top = 17;
box.left = 42;
box.width = 100;
box.height = 100;


var box = {top: 17, left: 42, width: 100, height: 100};

Furthermore how iterate in a array, pop/push in arrays, functions as arguments, javascript based in OO (working with prototype) and Dojo itself how works based OO, good code for this, including inheritance

Now is the turn in how dojo is included in a page, the code offered is not complex and easy to understand. good explanation

A tool very important like Firebug are introduced and how Dojo can work using this tool, even a simple list of log level is teaches us, some pretty nice is the console.dir() function that allows see the content of the passed argument

Something very important in a rich page is about handling, therefore functions connect and disconnect are instroduced, how do a relation about for a html object with dojo handling is teaches us, besides a long list about dojo.keys are offered too

Consider this chapter how a preview in what way about programming you would find in the follows chapters

Chapter 03 – Basic Dijit Knowledge

A chapter well cover, starting in how include dojo in a web page (like tundra.css, dojo.js, require a dijit widgit ) after that, how create in two ways a Dijit is available, and how find it (include an explanation between the diference about dojo/dijit.byId() )

After that more of three pages for a table for dijit widgits and a brief description is available.

Among other things in this chapter, Themes are cover with an image sample, I18N and formatting is well cover for both.

Chapter 04 – Ajax Communication

In these days a web application without Ajax is not reasonable.

Therefore Dojo Ajax features is introduced including an example code using dojo.xhr method, explanation about parameters and behavior of this method is well cover even including how to work with a callback method, furthermore a trick to avoid undesirable results when you expect some values retrieved from the server.

Afterthat the classic example "Hello World" is available, good code and well explained, the server side is managed with PHP,
something interesting in this code is that AOL CDN is used (recommend for mockups,easy porting )

How manage error and posting data (dojo.xhrPost) is teaches well, again a good code sample.

To end the chapter dojo.io.spript (request/JSONP) and "Remote Procedure Calls" are covered.

Chapter 05 – Forms

An important way to send information to the server is working with a "Form", this chapter cover this, therefore dijit.Form is introduced with a good code sample and explanation, something important are highlight in the code how "preventDefault" method or some equivalents methods like (stopPropagation or stopEvent) to prevent us some undesirable behaviour.

After that, validation,constraints,formats/patterns for special textfields are well cover, teaching us many options in the input elements related with these dijit widgets like TextBox, NumberTextBox, CurrencyTextBox, DateTextBox.

The chapter cover well other dijit components like CheckBoxes, Radio Button, Spinners, Sliders etc the code sample is concrete and with images, all this enough to understand clearly.

Chapter 06 – Layout

How the authors wrote The layout widgets in Dojo can often be alternatives to complicated CSS rules. Therefore if you had the pain with css, Dojo is useful for this, ContentPane is introduced, this can contain other widgets and plain html,
how to create this Container and the explanation of some parameters is available, a short list of Container functions with a concrete explanation is available too

After that the author teaches us many types of containers, given us an image to see but does and a snippet code with some special
attributes (depending the container) and of course with its explanation, easy to understand and not overloading, for instance for SplitContainer, StackContainer, TabContainer, AccordionContainer, BorderContainer.

Other interesting topic is DragPane with two samples about ExpandoPane and FloatingPane, good code sample with its images to see how this work.

An important and very useful topic is offered now, GridContainer, a good cover of this, many code, images and explanation

Chapter 07 – Data, Trees, and Grids

How display information for a user can be complicated some times, Dojo has its own features in how manage this, the chapter cover with long theory about functions support for dojo.data.(Read, Write, Identity, Notification)

An example is need it, therefore a tree is presented, with an image about how it should work, after that events (onClick,onOpen,onClose, even Drag,Drop) are added to the sample,
be advice that for information filled, this was done in a static way with arrays.

Cover for Grids is done, again static information is used, the cover is not deep, but is good, Grid views is cover, with an image for each view sample, how rendering, edit a cell and even how sort the grid is cover too.

These again is not cover in a concrete way, information for the grid is filled in a static way.

A connection with a database with a simple table to do more realistic this could be better.

Chapter 08 – Real-World Dojo

This chapter do reference to AOL’s and Google’s CDN (Content Delivery Network), what offer about its advantages and how do reference both into your application, something very interesting is DOH (Dojo Objective Harness) about unit testing, do reference to some files about what contents, but, where is the simple example using this?

The chapter has three examples

  • Example 1: Site navigation scaffolding
  • Example 2: Multi-charting application
  • Example 3: CRUD application

All are long cover, with good amount of code. For most used situation in real life the third sample is well cover including now its server side, working with php, but without data base connection.

Consider this sample not very realistic (no entities for instance, arrays instead used again) but for teaching purposes would be enough

Web Development for client side is very important, many options out there, Dojo is an important toolkit with a good respect in the comunity, even Spring Framework has its support for this.

I read this book to get a better knowledge for Dojo, because I used to work with Spring Framework (MVC – SWF ) and it has well integration with Dojo.

For medium developers would be able to get some quickly reference in your hands.


More Packt Publishing Books Reviews …