Create Application Using Ext Js

Total Page:16

File Type:pdf, Size:1020Kb

Create Application Using Ext Js Create Application using Ext Js By Dattu Dave Create Application using Ext Js | 1 1. Getting All Required Resources So these are the things we will develop, Now Let's start creating an application but before that you should have following things to develop application in EXT- JS I.Sencha Command - http://www.sencha.com/products/sencha-cmd/download II.Java Sdk - http://www.oracle.com/technetwork/java/javase/downloads/index.html (it is require to run sencha cmd properly) III. A web server - Xampp (http://www.apachefriends.org/en/xampp.html) we will use PHP as server side code we use database from xampp IV. EXT JS : http://www.sencha.com/products/extjs/ (download Ext JS 4.x) If you have all the above things in your pc, you can now start developing an application First Extract the EXT JS zip file you have downloaded from above url, we are here using Ext Js 4 for developing our application so, if you have any older version please download Ext Js 4.x version from http://www.sencha.com/products/extjs/ After downloading zip file extract the zip file into your servers root folder in our case we are using xampp so extract inside htdocs folder and rename it to extjs. 2. Creating an Application structure using Sencha Cmd The next step is to use the Sencha Cmd to create the application structure (MVC) for us. To do so, we need to open the terminal application that comes with the operating system we use. For Linux and Mac OS users, it is the terminal application, and for Windows users, the command prompt application. Now we need to change the current directory location in terminal or command prompt to Ext JS directory (htdocs/extjs directory in this case), and then we will use the following command: sencha generate app MyApp ../result as shown in following screenshot: Sencha generate command is use to create an directory structure of Ext Js for that you must require a directory of Ext Js that’s why we change our current location in terminal to Ext Js The directory structure of Ext Js follows MVC architecture, MyApp is the name of the namespace of our application, meaning that every class we create is going to start with MyApp, as for example: MyApp.model.Student, MyApp.view.Result, and so on. And the last argument passed to the command is the directory where the application will be created. In this case it is inside a folder named result, which is located inside the htdocsfolder. Create Application using Ext Js | 2 So when we execute this command we get following output: 3. Creating the loading page Let's start with the hands-on now! First, we need to edit the result/app.js file. This is how the file looks like: Ext.application({ name: 'MyApp', views: [ 'Main', 'Viewport' ], controllers: [ 'Main' ], autoCreateViewport: true }); Create Application using Ext Js | 3 We are going to change it so that it looks like the following(result/app.js): Ext.application({ name: 'MyApp', launch: function() { console.log('launch'); } }); On first line of the previous code we have the Ext.application declaration. This means that our application will have a single page and the parent container of the app will be the Viewport. The Viewport is a specialized container representing the viewable application area that is rendered inside the body tag of the HTML page (<body></body>). It also manages the application's size inside the browser and manages the window resizing. Inside Ext.application we can also declare models, views, stores, and controllers used by the application. We will add this information to this file as we create new classes for our project. We need to declare the name of the application “MyAPP” which will be the namespace. We can also create a launch function inside Ext.application. This function will be called after all the application's controllers are initialized and this means that the application is completely loaded. So this function is a good place to instantiate our main view. For now, we will only add console.log, which just prints on the browser's JavaScript interpreter console to verify if the application was loaded successfully. To execute this application on the browser, we can access http://localhost/result, and we will get the following output in console press(CTRL + SHIFT + I ) in chrome or (CTRL+SHIFT + K) in firefox: When working with large Ext JS applications, it is normal to have a small delay when loading the application. This happens because Ext JS is loading all the required classes to have the Create Application using Ext Js | 4 application up and running and meanwhile, all the users see is a blank screen, which can be annoying for them. A very common solution to this problem is to have a loading page, also known as a splash screen. So let's add a splash screen to our application that looks like the following: First we need to understand how this splash screen will work. At the moment the user loads the application and the loading screen will be displayed. The application will show the splash screen while it loads all the required classes and code so the application can be used. We already know that the application calls the launch function when it is ready to be used. So we know that we will need to remove the splash screen from the launch method. The question now is where inside Ext.application can we call the splash screen? The answer is inside the init function. The init function is called when the application boots so it gives some time for all required code to be loaded and after that the launch function is called. Now that we know how the splash screen will work, let's implement it. Inside Ext.application, we will implement a function called init: result/app.js Ext.application({ name: 'MyApp', Create Application using Ext Js | 5 init: function() { splashscreen = Ext.getBody().mask('Loading Please Wait', 'splashscreen'); }, launch: function() { console.log('launch'); } }); All we need to do is apply a mask into the HTML body of the application (Ext.getBody()), and that is why we are calling the mask method passing the loading message ("Loading Please Wait") and applying a CSS, which will be loading gif and is already part of the Ext JS CSS ("splashscreen"). The mask method will return Ext.dom.Element, which we will need to manipulate later (remove the mask from the HTML body) and for this reason, we need to keep a reference to Ext.dom.Element and we will store this reference inside an attribute of Ext.application: result/app.js Ext.application({ name: 'MyApp', splashscreen: {}, init : function() { … … }, .. … }); With the code of the init method only, we will have a loading screen as the following: Create Application using Ext Js | 6 If this is all you need that is ok. But let's go a little bit further and customize the loading screen adding a logo image so it can look like the first image of this topic, which is our final output. First, we need to create a CSS file which will contain all the CSS for our application. First create css folder inside result/resources/ and then create css file We will name it as app.css and put it inside a result/resources/css/ folder: Inside resources we will also create an images folder with the Attuneuniversity logo image. We also must not forget to add the new CSS file into result/index.html: <link rel="stylesheet" href="resources/css/app.css"> Now add following things to result/resources/css/app.css file we just created .x-mask.splashscreen { background-color: #efefef; opacity: 1; } .x-mask-msg.splashscreen, .x-mask-msg.splashscreen div { font-size: 16px; font-weight: bold; padding-top : 17px; padding-right : 40px; border: none; background-color: transparent; background-position: top center; } .x-message-box .x-window-body .x-box-inner { min-height: 93px !important; } .x-splash-icon { background-image: url('../images/logo.png') !important; background-repeat : no-repeat; margin-top: -30px; margin-bottom: 15px; height: 100px; width : 200px; } We will be adding a new CSS style to the loading DIV tag. Note that the following styles from our app.css file will be applied: .x-mask.splashscreen and .x-mask-msg.splashscreendiv. This Create Application using Ext Js | 7 will going to change the font of the "Loading Please Wait" message. Now we will add the following code in the init function inside result/app.js: init: function() { splashscreen = Ext.getBody().mask('Loading Please Wait' , 'splashscreen'); splashscreen.addCls('splashscreen'); Ext.DomHelper.insertFirst(Ext.query('.x-mask-msg')[0], { cls: 'x-splash-icon' }); }, After we execute the previous code, we will have an output exactly as the image we showed at the beginning of this topic. Now we already have the splash screen being displayed. We need to work on the launch function to remove the splash screen after all the code the application needs is loaded, otherwise the loading message will be there indefinitely! To remove the splash screen the only code we need to add to the launch function is the following one, which is removing the mask from the HTML body: result/app.js Ext.getBody().unmask(); However, removing the mask abruptly is not nice because the user cannot even see the loading message. Instead of only removing the mask, let's give the user 2 seconds to see the loading message after the application is ready: result/app.js var task = new Ext.util.DelayedTask(function() { Ext.getBody().unmask(); }); task.delay(2000); To do so, we are going to use the DelayedTask class, which is a class that provides a chance of a function to be executed after the given timeout in milliseconds.
Recommended publications
  • Pragmatic Guide to Javascript
    www.allitebooks.com What Readers Are Saying About Pragmatic Guide to J a v a S c r i p t I wish I had o w n e d this book when I first started out doing JavaScript! Prag- matic Guide to J a v a S c r i p t will take you a big step ahead in programming real-world JavaScript by showing you what is going on behind the scenes in popular JavaScript libraries and giving you no-nonsense advice and back- ground information on how to do the right thing. W i t h the condensed years of e x p e r i e n c e of one of the best JavaScript developers around, it’s a must- read with great reference to e v e r y d a y JavaScript tasks. Thomas Fuchs Creator of the script.aculo.us framework An impressive collection of v e r y practical tips and tricks for getting the most out of JavaScript in today’s browsers, with topics ranging from fundamen- tals such as form v a l i d a t i o n and JSON handling to application e x a m p l e s such as mashups and geolocation. I highly recommend this book for anyone wanting to be more productive with JavaScript in their web applications. Dylan Schiemann CEO at SitePen, cofounder of the Dojo T o o l k i t There are a number of JavaScript books on the market today, b u t most of them tend to focus on the new or inexperienced JavaScript programmer.
    [Show full text]
  • THE FUTURE of SCREENS from James Stanton a Little Bit About Me
    THE FUTURE OF SCREENS From james stanton A little bit about me. Hi I am James (Mckenzie) Stanton Thinker / Designer / Engineer / Director / Executive / Artist / Human / Practitioner / Gardner / Builder / and much more... Born in Essex, United Kingdom and survived a few hair raising moments and learnt digital from the ground up. Ok enough of the pleasantries I have been working in the design field since 1999 from the Falmouth School of Art and onwards to the RCA, and many companies. Ok. less about me and more about what I have seen… Today we are going to cover - SCREENS CONCEPTS - DIGITAL TRANSFORMATION - WHY ASSETS LIBRARIES - CODE LIBRARIES - COST EFFECTIVE SOLUTION FOR IMPLEMENTATION I know, I know, I know. That's all good and well, but what does this all mean to a company like mine? We are about to see a massive change in consumer behavior so let's get ready. DIGITAL TRANSFORMATION AS A USP Getting this correct will change your company forever. DIGITAL TRANSFORMATION USP-01 Digital transformation (DT) – the use of technology to radically improve performance or reach of enterprises – is becoming a hot topic for companies across the globe. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-02 Companies face common pressures from customers, employees and competitors to begin or speed up their digital transformation. However they are transforming at different paces with different results. VERY DIGITAL CHANGING NOT VERY DIGITAL DIGITAL TRANSFORMATION USP-03 Successful digital transformation comes not from implementing new technologies but from transforming your organisation to take advantage of the possibilities that new technologies provide.
    [Show full text]
  • Bforartists UI Redesign Design Document Part 2 - Theming
    Bforartists UI redesign Design document part 2 - Theming Content Preface...........................................................................................................................6 The editor and window types......................................................................................7 Python console.............................................................................................................8 Layout:................................................................................................................................................................8 The Console Window.........................................................................................................................................8 Menu bar with a menu........................................................................................................................................8 Dropdown box with icon....................................................................................................................................9 RMB menu for menu bar....................................................................................................................................9 Toolbar................................................................................................................................................................9 Button Textform..................................................................................................................................................9
    [Show full text]
  • HCI Lessons Using AJAX for a Page-Turning Web Application
    CHI 2011 • Session: Reading & Writing May 7–12, 2011 • Vancouver, BC, Canada Bells, Whistles, and Alarms: HCI Lessons Using AJAX for a Page-turning Web Application Juliet L. Hardesty Abstract User Interface Design Specialist This case study describes creating a version of METS Digital Library Program Navigator, a page-turning web application for multi- Indiana University part digital objects, using an AJAX library with user Herman B Wells Library, W501 interface components. The design for this version 1320 E. 10th Street created problems for customized user interactions and Bloomington, IN 47405 USA accessibility problems for users, including those using [email protected] assistive technologies and mobile devices. A review of the literature considers AJAX, accessibility, and universal usability and possible steps to take moving forward to correct these problems in METS Navigator. Keywords AJAX, accessibility, universal usability ACM Classification Keywords H.5.2. Information interfaces and presentation: User interfaces - user-centered design, standardization. General Terms Design, human factors, standardization Copyright is held by the author/owner(s). CHI 2011, May 7–12, 2011, Vancouver, BC, Canada. Introduction ACM 978-1-4503-0268-5/11/05. AJAX (Asynchronous JavaScript and XML) is a widely used method for developing Web 2.0 applications 827 CHI 2011 • Session: Reading & Writing May 7–12, 2011 • Vancouver, BC, Canada (called Rich Internet Applications, or RIA’s), both to incorporate the Semantic Web into Web 2.0 enhance certain features
    [Show full text]
  • Workspace Desktop Edition Developer's Guide
    Workspace Desktop Edition Developer's Guide Best Practices for Views 10/3/2021 Contents • 1 Best Practices for Views • 1.1 Keyboard Navigation • 1.2 Branding • 1.3 Localization • 1.4 Parameterization • 1.5 Internationalization • 1.6 Screen Reader Compatibility • 1.7 Themes • 1.8 Loosely-coupled Application Library and Standard Controls • 1.9 Views Workspace Desktop Edition Developer's Guide 2 Best Practices for Views Best Practices for Views Purpose: To provide a set of recommendations that are required in order to implement a typical view within Workspace Desktop Edition. Workspace Desktop Edition Developer's Guide 3 Best Practices for Views Keyboard Navigation TAB Key--Every control in a window has the ability to have focus. Use the TAB key to move from one control to the next, or use SHIFT+TAB to move the previous control. The TAB order is determined by the order in which the controls are defined in the Extensible Application Markup Language (XAML) page. Access Keys--A labeled control can obtain focus by pressing the ALT key and then typing the control's associated letter (label). To add this functionality, include an underscore character (_) in the content of a control. See the following sample XAML file: [XAML] <Label Content="_AcctNumber" /> Focus can also be given to a specific GUI control by typing a single character. Use the WPF control AccessText (the counterpart of the TextBlock control) to modify your application for this functionality. For example, you can use the code in the following XAML sample to eliminate having to press the ALT key: [XAML] <AccessText Text="_AcctNumber" /> Shortcut Keys--Trigger a command by typing a key combination on the keyboard.
    [Show full text]
  • The Snap Framework: a Web Toolkit for Haskell
    The Functional Web The Snap Framework A Web Toolkit for Haskell Gregory Collins • Google Switzerland Doug Beardsley • Karamaan Group askell is an advanced functional pro- the same inputs, always produce the same out- gramming language. The product of more put. This property means that you almost always H than 20 years of research, it enables rapid decompose a Haskell program into smaller con- development of robust, concise, and fast soft- stituent parts that you can test independently. ware. Haskell supports integration with other Haskell’s ecosystem also includes many power- languages and has loads of built-in concurrency, ful testing and code-coverage tools. parallelism primitives, and rich libraries. With Haskell also comes out of the box with a set its state-of-the-art testing tools and an active of easy-to-use primitives for parallel and con- community, Haskell makes it easier to produce current programming and for performance pro- flexible, maintainable, high-quality software. filing and tuning. Applications built with GHC The most popular Haskell implementation is enjoy solid multicore performance and can han- the Glasgow Haskell Compiler (GHC), a high- dle hundreds of thousands of concurrent net- performance optimizing native-code compiler. work connections. We’ve been delighted to find Here, we look at Snap, a Web-development that Haskell really shines for Web programming. framework for Haskell. Snap combines many other Web-development environments’ best fea- What’s Snap? tures: writing Web code in an expressive high- Snap offers programmers a simple, expressive level language, a rapid development cycle, fast Web programming interface at roughly the same performance for native code, and easy deploy- level of abstraction as Java servlets.
    [Show full text]
  • Analysing the Use of Outdated Javascript Libraries on the Web
    Updated in September 2017: Require valid versions for library detection throughout the paper. The vulnerability analysis already did so and remains identical. Modifications in Tables I, III and IV; Figures 4 and 7; Sections III-B, IV-B, IV-C, IV-F and IV-H. Additionally, highlight Ember’s security practices in Section V. Thou Shalt Not Depend on Me: Analysing the Use of Outdated JavaScript Libraries on the Web Tobias Lauinger, Abdelberi Chaabane, Sajjad Arshad, William Robertson, Christo Wilson and Engin Kirda Northeastern University {toby, 3abdou, arshad, wkr, cbw, ek}@ccs.neu.edu Abstract—Web developers routinely rely on third-party Java- scripts or HTML into vulnerable websites via a crafted tag. As Script libraries such as jQuery to enhance the functionality of a result, it is of the utmost importance for websites to manage their sites. However, if not properly maintained, such dependen- library dependencies and, in particular, to update vulnerable cies can create attack vectors allowing a site to be compromised. libraries in a timely fashion. In this paper, we conduct the first comprehensive study of To date, security research has addressed a wide range of client-side JavaScript library usage and the resulting security client-side security issues in websites, including validation [30] implications across the Web. Using data from over 133 k websites, we show that 37 % of them include at least one library with a and XSS ([17], [36]), cross-site request forgery [4], and session known vulnerability; the time lag behind the newest release of fixation [34]. However, the use of vulnerable JavaScript libraries a library is measured in the order of years.
    [Show full text]
  • Cross-Platform Mobile Application for the Cothority
    Cross-Platform Mobile Application for the Cothority Vincent Petri & Cedric Maire School of Computer and Communication Sciences Decentralized and Distributed Systems Lab Semester Project January 2018 Responsible Supervisor Prof. Bryan Ford Linus Gasser EPFL / DeDiS EPFL / DeDiS 2 Acknowledgements We would like to express our special thanks to Linus Gasser who gave us the opportunity to do this very interesting project related to the collec- tive authority (Cothority) framework developed by the DeDiS laboratory at EPFL. We would like to thank him for the valuable help he gave us whenever we needed and for the knowledge he provided to us throughout the semester. Secondly, we would also like to thank our parents and friends who helped us through the hard times of finalising the project within the limited time frame. 3 1 Abstract The Cothority2 framework has been developed and maintained by the DeDiS laboratory at EPFL. This project provides a framework for develop- ing, analysing, and deploying decentralised and distributed cryptographic protocols. A set of servers that runs these protocols and communicates among each other is referred to as a collective authority, or cothority, and the individual servers are called cothority servers or conodes. A cothority that executes decentralised protocols could be used for collective signing, threshold signing, or the generation of public-randomness, to name only a few options. The highest level of abstraction can be created by protocols like the collective signature (CoSi) protocol, the random numbers (Rand- Hound) protocol, or the communication (Messaging) protocol used by the conodes to exchange data. Then come the services, which rely on these pro- tocols.
    [Show full text]
  • Using Windows XP and File Management
    C&NS Summer ’07 Faculty Computer Training Introduction to the Mac Table of Contents Introduction to the Mac....................................................................................................... 1 Mac vs. PC.......................................................................................................................... 2 Introduction to Apple OS X (Tiger).................................................................................... 2 The OS X Interface ......................................................................................................... 3 Tools for accessing items on your computer .................................................................. 3 Menus.............................................................................................................................. 7 Using Windows............................................................................................................... 8 The Dock....................................................................................................................... 10 Using Mac OS X............................................................................................................... 11 Hard Drive Organization............................................................................................... 11 Folder and File Creation, Managing, and Organization ............................................... 12 Opening and Working with Applications ....................................................................
    [Show full text]
  • The Effect of Ajax on Performance and Usability in Web Environments
    The effect of Ajax on performance and usability in web environments Y.D.C.N. op ’t Roodt, BICT Date of acceptance: August 31st, 2006 One Year Master Course Software Engineering Thesis Supervisor: Dr. Jurgen Vinju Internship Supervisor: Ir. Koen Kam Company or Institute: Hyves (Startphone Limited) Availability: public domain Universiteit van Amsterdam, Hogeschool van Amsterdam, Vrije Universiteit 2 This page intentionally left blank 3 Table of contents 1 Foreword ................................................................................................... 6 2 Motivation ................................................................................................. 7 2.1 Tasks and sources................................................................................ 7 2.2 Research question ............................................................................... 9 3 Research method ..................................................................................... 10 3.1 On implementation........................................................................... 11 4 Background and context of Ajax .............................................................. 12 4.1 Background....................................................................................... 12 4.2 Rich Internet Applications ................................................................ 12 4.3 JavaScript.......................................................................................... 13 4.4 The XMLHttpRequest object..........................................................
    [Show full text]
  • Download Ebook ^ Javascript: Ajax, Cross-Site Scripting, Couchdb
    W5CAMG0U1NWQ < PDF ^ JavaScript: Ajax, Cross-Site Scripting, CouchDB, WebKit, JQuery, Dojo Toolkit, Bookmarklet, ActionScript, V8,... JavaScript: A jax, Cross-Site Scripting, Couch DB, W ebKit, JQuery, Dojo Toolkit, Bookmarklet, A ctionScript, V 8, SpiderMonkey, Qooxdoo, Ext JS Filesize: 7.09 MB Reviews It becomes an amazing book which i actually have at any time study. It is actually loaded with wisdom and knowledge You wont sense monotony at at any time of your respective time (that's what catalogues are for regarding should you request me). (Rosina Schowalter V) DISCLAIMER | DMCA EUQW6UIGSWMD > Kindle « JavaScript: Ajax, Cross-Site Scripting, CouchDB, WebKit, JQuery, Dojo Toolkit, Bookmarklet, ActionScript, V8,... JAVASCRIPT: AJAX, CROSS-SITE SCRIPTING, COUCHDB, WEBKIT, JQUERY, DOJO TOOLKIT, BOOKMARKLET, ACTIONSCRIPT, V8, SPIDERMONKEY, QOOXDOO, EXT JS Books LLC, Wiki Series, 2011. Condition: New. This item is printed on demand for shipment within 3 working days. Read JavaScript: Ajax, Cross-Site Scripting, CouchDB, WebKit, JQuery, Dojo Toolkit, Bookmarklet, ActionScript, V8, SpiderMonkey, Qooxdoo, Ext JS Online Download PDF JavaScript: Ajax, Cross-Site Scripting, CouchDB, WebKit, JQuery, Dojo Toolkit, Bookmarklet, ActionScript, V8, SpiderMonkey, Qooxdoo, Ext JS R6UOTKQRMAXT « PDF \ JavaScript: Ajax, Cross-Site Scripting, CouchDB, WebKit, JQuery, Dojo Toolkit, Bookmarklet, ActionScript, V8,... See Also A Smarter Way to Learn JavaScript: The New Approach That Uses Technology to Cut Your Effort in Half Createspace, United States, 2014. Paperback. Book Condition: New. 251 x 178 mm. Language: English . Brand New Book ***** Print on Demand *****.The ultimate learn-by-doing approachWritten for beginners, useful for experienced developers who want to... Read PDF » Why We Hate Us: American Discontent in the New Millennium Random House USA Inc, United States, 2009.
    [Show full text]
  • Sencha Web Application Lifecycle Management Platform
    Sencha Web Application Lifecycle Management Platform Businesses are under more pressure than ever to deliver Develop sophisticated web applications to their customers as quickly as possible. These applications are expected to be high quality, It’s critical for developers to reduce time to market and deliver visually compelling and run on multiple devices including desktops, high-quality products. We provide comprehensive frameworks tablets, and smartphones. Plus, many of these applications will that teams can use to build cross-platform web applications. We live for several years meaning that organizations have to consider offer both a JavaScript framework – Sencha Ext JS, and a Java the cost of maintaining and upgrading the application over the framework – Sencha GXT. long term. Sencha Ext JS For developers who want to use HTML5, CSS, and JavaScript, there The Sencha Mission is no better choice than Ext JS. More than 60% of the Fortune 100 Our mission is to help organizations deliver the right experience on rely on Ext JS and its comprehensive component library. the right screen at the right time. To deliver on this mission, we’ve It comes with everything a developer needs to create a created the Sencha Web Application Lifecycle Management Platform complex web application including UI component, data package, for designing, developing, deploying and managing cross-platform advanced charts, and application templates to help developers web applications. jumpstart their development efforts. Plus from a single code base, developers can create
    [Show full text]