Creating Mobile Apps with Sencha Touch 2 Learn to use the Sencha Touch programming language and expand your skills by building 10 unique applications John Earl Clark Bryan P. Johnson BIRMINGHAM - MUMBAI Creating Mobile Apps with Sencha Touch 2 Copyright © 2013 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 authors, nor Packt Publishing, and its dealers and 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 of 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: April 2013 Production Reference: 1280313 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84951-890-1 www.packtpub.com Cover Image by Avishek Roy ([email protected]) Credits Authors Proofreaders John Earl Clark Maria Gould Bryan P. Johnson Kate Robinson Reviewer Indexer Kristian Kristensen Tejal Soni Acquisition Editor Graphics Usha Iyer Ronak Dhruv Lead Technical Editor Production Coordinators Sweny Sukumaran Manu Joseph Nilesh Mohite Technical Editors Nitesh Thakur Jalasha D'costa Saumya Kunder Cover Work Nitesh Thakur Project Coordinator Amey Sawant About the Authors John Earl Clark holds a Master's degree in Human Computer Interaction from Georgia Tech and an undergraduate degree in Music Engineering from Georgia State University. John and his co-author, Bryan P. Johnson, worked together at MindSpring and later EarthLink, starting out in technical support and documentation, before moving into application development, and finally management of a small development team. After leaving EarthLink in 2002, John began working independently as a consultant and programmer, before starting Twelve Foot Guru, LLC with Bryan in 2005. John has been working with Sencha Touch since the first early beta releases. He has also worked with Sencha's ExtJS since the early days when it was still known as YUI-Ext. John has also written a previous book with Bryan Johnson called Sencha Touch Mobile JavaScript Framework by Packt Publishing. When he is not buried in code, John spends his time woodworking, playing the guitar, and brewing his own beer. I would like to thank my family for all of their love and support. I would also like to thank Bryan for his help, his patience, and his continued faith in our efforts. Bryan P. Johnson is a graduate of the University of Georgia. Bryan went on to work for MindSpring Enterprises in late 1995, where he met his co-author John Clark. At MindSpring, and later EarthLink, for over seven years, Bryan served in multiple positions, including Director of System Administration and Director of Internal Application Development. After leaving EarthLink, Bryan took some time off to travel before joining John in starting Twelve Foot Guru. Bryan has worked with Sencha's products since the early days of YUI-EXT, and has used Sencha Touch since its first betas. Last year, he and John wrote their first Sencha Touch book, Sencha Touch Mobile JavaScript Framework by Packt Publishing. I would like to thank my friends and family for their support and my co-author John for his patience during the creation of this book. About the Reviewer Kristian Kristensen is an independent software development consultant. Through his company Kristensen Inc., he takes on the role of teacher, coach, facilitator, and anything in between to help software shops improve their processes and skills. He is particularly interested in languages and how they shape our thoughts and problem solving abilities. He worked as a consultant for Microsoft before embarking on the journey of freelance consulting. He holds a Master's in Software Engineering from Aalborg University and currently lives in Brooklyn, NY with his wife. For Heather… www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Preface 1 Chapter 1: A Simple Task List 7 A brief overview of Sencha Architect 7 The Toolbox 10 The help section 11 The design area 12 The Project Inspector area 13 The Config area 14 Getting started with the task list 14 Creating the data store 15 Adding a Model, Fields, and Field Types 16 Adding the model to the store 17 Making copies 18 Adding filters 19 Pay attention to the man behind the curtain 20 Architect versus coding by hand 25 Creating the views 25 Configuring the Tab Panel 27 Adding the lists and details 28 Setting up the templates 30 Testing with starter data 31 Adding the back button 34 Creating the forms 35 Add Task form 35 Editing and completing a task 39 Testing the application 40 Extra credit 41 Summary 41