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

Models


Some widgets can use (and for some configurations require) a man-in-the-middle object, called a model. The model can act as a decorator, which adds information about the data from the store or about how it is to be parsed which is not applicable to the data itself.

For instance, the Tree widget can use a model object which defines the label for the tree, and the Grid widget prior to 1.2 required a model between the Grid and its store for setting queries.

The models are internal to the component using them, with a specific model.js file describing the contract used for the specific component or widget.

Models communicate changes in their state both up to the component and down to the data store, so if a Tree adds a new item to a branch, it will inform the model, which in turn updates the data store. Conversely, if the data store gets an item deleted, it will update the model, which in turn updates the Tree.