Mastering Dojo JavaScript and Ajax Tools for Great Web Experiences~tqw~_darksiderg.pdf

(4961 KB) Pobierz
652298319 UNPDF
652298319.011.png
What readers are saying about Mastering Dojo
I’m so glad to see this book released. Dojo has a lot of power, but
there’s also a lot of complexity to knowing which API methods to use
when, and how to use them, and this book goes beyond just explain-
ing the Dojo API to explaining what developers need to know to use it
effectively.
Bill Keese
Project lead for Dijit
IBM, Emerging Technology Group
Mastering Dojo will teach you how to build an Internet application
that will impress your end users and delight you while you’re writing
it. The book also explains Dojo’s JavaScript underpinnings, both for
newcomers and for refugees from other languages.
Ian Dees
Software engineer
The book really rolls out the red carpet for Dojo to emerge with guns
blazing! The authors show you how easy it is to use impressive
widgets without installing a thing. I was amazed to discover that
JavaScript is not just a toy language, how Dojo is built on top of it,
and how both are invaluable in any web development project. Buy
this book. It’s the next best thing to having the authors working at
your side.
Brian C. Reeve
Application developer, bluecomIT.com
Mastering Dojo is an understandable, in-depth guide to learning the
Dojo Toolkit. It’s a great supplement to the Dojo Toolkit’s online docu-
mentation.
Steve Orvell
Senior Engineer, WaveMaker Software
652298319.012.png
Mastering Dojo
JavaScript and Ajax Tools
for Great Web Experiences
Rawld Gill
Craig Riecke
Alex Russell
The Pragmatic Bookshelf
Raleigh, North Carolina Dallas, Texas
 
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as trademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.
The Browser Application Framework code is Copyright © 2000-2008, Vista Information
Technologies, Inc., and released under the BSD license.
Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.
Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at
Copyright © 2008 Rawld Gill, Craig Riecke and Alex Russell.
All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmit-
ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.
Printed in the United States of America.
ISBN-10: 1-934356-11-5
ISBN-13: 978-1-934356-11-1
Printed on acid-free paper with 50% recycled, 15% post-consumer content.
652298319.013.png 652298319.001.png 652298319.002.png 652298319.003.png 652298319.004.png 652298319.005.png 652298319.006.png 652298319.007.png 652298319.008.png 652298319.009.png 652298319.010.png
Contents
9
1.1
Key Aspects of Dojo . . . . . . . . . . . . . . . . . . . . .
12
1.2
Using the Book . . . . . . . . . . . . . . . . . . . . . . .
15
1.3
Acknowledgments . . . . . . . . . . . . . . . . . . . . . .
17
19
20
2.1
21
2.2
Installing Dojo on Your Own Server . . . . . . . . . . . .
21
2.3
Adding Dojo and Dijit to a Page . . . . . . . . . . . . . .
22
2.4
Laying Out the Form . . . . . . . . . . . . . . . . . . . .
26
2.5
Improved Form Controls . . . . . . . . . . . . . . . . . .
31
2.6
Wrapping It Up . . . . . . . . . . . . . . . . . . . . . . .
34
37
3.1
Dojo Remote Scripting . . . . . . . . . . . . . . . . . . .
37
3.2
JavaScript Idioms for Calling XHR . . . . . . . . . . . .
39
3.3
46
3.4
Researching Cigars Using JSONP . . . . . . . . . . . . .
56
3.5
Reviews with dojo.xhrGet . . . . . . . . . . . . . . . . .
63
3.6
Errors and Debugging . . . . . . . . . . . . . . . . . . .
67
70
71
4.1
Modularizing JavaScript . . . . . . . . . . . . . . . . . .
71
4.2
Dojo Source Code Organization . . . . . . . . . . . . . .
75
4.3
Loading Dojo . . . . . . . . . . . . . . . . . . . . . . . . .
78
 
Zgłoś jeśli naruszono regulamin