19,16 €
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.
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.
Learning Dojo gives in-depth as well as practical explanations of using the Dojo AJAX JavaScript Toolkit to create powerful and dynamic websites.
The book is an example-based tutorial. Once the basics are done, it takes the reader through creating a number of examples, each focussed on a different interface task or visual effect.
This book is for web developers with JavaScript knowledge, who want to use Dojo for developing dynamic Web 2.0 applications.
Readers need basic web-page creation skills, HTML and CSS, and should be comfortable with the syntax of JavaScript.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 273
Veröffentlichungsjahr: 2008
Copyright © 2008 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2008
Production Reference: 1201108
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847192-68-4
www.packtpub.com
Cover Image by Raghuram Ashok (<[email protected]>)
Author
Peter Svensson
Reviewers
Eugene Lazutkin
Meenakshi Singh
Acquisition Editor
Rashmi Phadnis
Development Editor
Usha Iyer
Technical Editor
Dhiraj Bellani
Editorial Team Leader
Mithil Kulkarni
Project Manager
Abhijeet Deobhakta
Project Coordinator
Leena Purkait
Indexer
Rekha Nair
Proofreader
Angie Butcher
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
Peter Svensson is an Ajax evangelist and front-end architect at Nethouse AB. He is the instigator of the Thin Server Architecture Working Group and a Dojo contributor. He's an avid JavaScript aficionado who really likes dynamic languages and would very much appreciate if the rest of the world would catch up really soon.
I'd like to thank my wonderful family; my son Adam for being the best pokémon master in the universe, my daughter Elsa for not sounding like a vildvittra most of the time, my wife Carina for being completely wonderful, and my mother Agneta for picking up our kids from school umpteen times a week.
Eugene Lazutkin is a veteran software developer based in Dallas, Texas. Working in the web development business for a long time, he is a firm believer in the power of Open Source, and an active participant in open-source projects. As a committer of the Dojo Toolkit, he is responsible for the Dojo DnD module (part of the Dojo Core), the dojox.gfx module (portable cross-platform browser-based vector graphics supporting SVG, VML, Silverlight, and Canvas), the charting module (based on dojox.gfx, it brings the power of interactive graphics to dynamic web applications), and numerous language-related enhancements (the functional programming module, the aspect-oriented programming module, and so on). While not programming for SitePen or working on improving Dojo, he writes technical articles that can be found at his company blog at http://blog.sitepen.com/, or in his personal blog at http://lazutkin.com/.
I want to thank my wife Svetlana, and my daughter Christina for putting up with my long hours, all Dojo contributors (http://dojotoolkit.org/dojo-contributors) for making this very book possible, and fellow committers for clarifying some fine points for me when I was reviewing this book.
Dojo is arguably the most feature-packed Ajax toolkit available today, with a wide variety of functionality. It can be used sparsely to just add effects or styling to your web page, or it can be used for complex layouts, caching data stores, and interactive 2D graphics — the choice is yours. This book aims to give an overview of all major aspects of Dojo while at the same time giving lots of examples to copy for your own studies and websites.
Chapter 1 Introduction to Dojo: This chapter will give you an overview of the Dojo Ajax framework along with tips and tricks for usage of JavaScript and useful and generic Dojo functions.
Chapter 2 Useful JavaScript and Dojo Tricks: This chapter explains Dojo's approach to object-oriented programming with JavaScript.
Chapter 3 Basic Dijit Knowledge: Dijits is Dojo's name for Widgets. A typical widget is a colorpicker or a movable pane. This chapter introduces Dijits in general and gives a lot of examples on how to use them, how they interact, and even an introduction to writing your own.
Chapter 4 Ajax Communication: This chapter covers Ajax communication in several aspects, with examples, which also show the view from the server (in PHP code).
Chapter 5 Form-Related Dijits: This chapter focuses on serializing forms and powerful validation and Internationalization. It covers best practices when setting up Dojo forms and includes a run-down of available components.
Chapter 6 Layouts: The Layout Dijit organizes the content, be it other Dijits or plain HTML. This chapter shows a number of examples from simplifying layout in general with 'CSS-less' layout managers, to dynamic loading of content in content panes, and how to create a wizard widget with a StackContainer and a small amount of scripting.
Chapter 7 Data, Trees, and Grids: The datastores are perhaps the most complex area of Dojo, but they also give the programmer an unprecedented level of modularity. We'll go over a couple of simple examples, then describe the dojo.data interface, how to extend them, and how to use several different types of data in the same Dijit component.
Chapter 8 Real-World Dojo: This chapter is almost entirely examples, and focuses on giving the reader full-blown guides on how to create several types of applications with Dojo, and will also be a store for cut-and-paste problem solving when time is of essence.
You need a computer connected to the Internet that regardless of operating system has a modern web browser (IE6, Firefox 1.5, Safari 1.3.2). Also, you need to know at least one programming language, preferably with a C-like syntax (C++, C#, Java). To follow all the examples, you need to download the latest source version of Dojo from http://download.dojotoolkit.org/current-stable/. At the time of writing of this book, that file was called dojo-release-1.2.1-src.zip.
This book is for web developers with JavaScript knowledge, who want to use Dojo for developing dynamic Web 2.0 applications.
Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to <[email protected]>, making sure to mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Visit http://www.packtpub.com/files/code/2684_Code.zip to directly download the example code.
The downloadable files contain instructions on how to use them.
Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books — maybe a mistake in text or code — we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide the location address or website name immediately so we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with some aspect of the book, and we will do our best to address it.
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 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:
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.
