Book Image

Learning Dojo

By : Peter Svensson
Book Image

Learning Dojo

By: Peter Svensson

Overview of this book

<p>Dojo is a popular AJAX-specific open-source JavaScript framework for building powerful web applications. It provides a well conceived API and set of tools to assist you and fix the issues experienced in everyday web development. Your project size is no concern while using Dojo. It is the best scalable solution to all your size-related issues.<br /> <br />This book starts by giving you tips and tricks for programming with JavaScript. These tricks will help you with Dojo. With every chapter, you will learn advanced JavaScript techniques. You will learn to leverage Dojo for a clean web application architecture using JSON or XML.</p>
Table of Contents (13 chapters)
Learning Dojo
Credits
About the Author
About the Reviewer
Preface
Free Chapter
1
Introduction to Dojo

Chapter 1. Introduction to Dojo

For a budding Ajax developer, there is plenty to choose from. Even before the term was coined in 2005, there has been an abundance of JavaScript libraries available, most of them geared to particular tasks.

Lately, what came to be known as Ajax libraries or Ajax frameworks have taken on a more general nature. They are not only hand-crafted to hide the complexities of client-server communication, building sortable and dynamic tables or providing dynamic menus. The Ajax frameworks of today aspire to be one-stop shops doing everything from class-based inheritance and generic events to encryption, real-time 3D Graphics, and in-browser data buses.

Of all these frameworks, Dojo is perhaps the most generic, tracing its roots to not one but several different JavaScript libraries of yore. As you're reading this book, you have at least decided to take a look at what Dojo can offer, in terms of features, ease of use, and developmental complexity (or lack thereof). Maybe you have already decided to use Dojo, based on a special need that only Dojo can help you with, or for the general abundance of features.

The version of Dojo used in this book is post 1.1, up to 1.2RC1. Since Dojo is continually in rapid development, with a target of three months between every minor release, I wanted to include as many 'goodies' as possible during the writing of this book. Make sure to go to the website of this book to take part in any errata or updates made available since it went in print. Also, to dowload the examples, use the following URL: http://www.packtpub.com/files/code/2684_Code.zip.

Dojo usage

Dojo can be used a piece at a time. Just because you use Dojo to handle Ajax communication with the server, does not mean that you have to use it for event management of button clicks or drawing diagrams, but you can if you want. Dojo plays nice with other toolkits and technologies and can be used as little or as much as you would like.

The most common scenario is probably to use Dojo to add a specific function to an existing website. Examples of this are:

  • An animated navigational menu for different pages of the site.

  • Draggable 'windows' of information for a particular page.

  • A sortable table of products.

  • A combobox which gets all selectable items asynchronously from the server at runtime.

Perhaps the site is already using other toolkits like YUI or jQuery, but Dojo is chosen for a specific component that is not found in the toolkits already present.

More and more, Dojo is used to write true clients which are downloaded to the browser once, in the shape of an HTML file which refers to Dojo's JavaScript and CSS files, and which, after that only, communicates with the server using Ajax technology. This approach is very efficient when replacing or rewriting existing desktop applications to be used on the web.

The book will cover all these examples and many more, with three practical full-length examples in the last chapter, which are meant to be used as templates for your own needs.