SlideShare a Scribd company logo
1 of 61
Rich Web Applications With




                      mats@bryntum.com

                      @bryntum
Agenda
• Who am I?
• What is Ext JS?
• When (not) to use Ext JS
• Ext Class system
• Widgets, Grids, Forms, Trees
• Dealing with data
• Extending Ext JS classes
Before we start




     #comday
Mats Bryntse
o 35+ yrs old
o From Helsingborg, Sweden
o Background:
  o Worked 7 years as SW consultant: C#, ASP.NET, C
  o Found Ext JS in 2007, never looked back
  o Started Bryntum 2009, http://bryntum.com


o I create JS components & test tools for Ext
  JS.
o Twitter: @bryntum
What is Ext JS?


Ext JS is a client-side
JavaScript framework
 for building rich web
     applications.
Who has heard of Ext JS
       before?
Ext JS background &
                   facts

• Began as YUI-Ext in 2006, 1.0 in 2007, now
  v4.1.

• Company called Sencha, based in Palo Alto

• Funded by Sequoia Capital (Google, Yahoo!, Paypal, YouTube)

• Community Forum >300k members
Ext JS features

• Full UI application development suite

• Powerful & extensible widgets:
  grids, forms, trees, charts

• Data package, class system, MVC, Ext Designer

• Familiar Windows-like look & feel, layout engine
When to use Ext JS



• Write web applications not web sites

• Typically LOB applications, intranet apps etc.

• Data intensive apps, gathering, displaying, filtering
When not to use Ext JS


• Write web sites

• Write sites or apps targeting mobile/tablet.
     Instead use Sencha Touch or jQuery Mobile


• If SEO matters

• If initial page load time is critical
Traditional web dev pain points

• Too much time spent defining the user interface

• Browsers quirks => need hacks => uncertainty

• Multiple authors of UI code
        => inconsistent look & feel.
        => easy to end up with function soup

• JS/UI unit testing often an afterthought

• Sounds familiar?
Benefits of using Ext JS

• Simple, config-driven, standardized API

• X-browser support, incl. our favorite IE6

• Spend time writing business logic, not HTML tags or
  complex CSS layouts.

• Less time spent chasing X-browser bugs
Hello World in Firebug
JavaScript centric

• Ext JS is all about OOP in JavaScript

• Only basic HTML/CSS skills required

• The Hello World oneliner:
   • Generated 50+ DOM nodes.
   • No time was spent developing the user interface

• A typical Ext JS application uses a single HTML page
  (SPI)
Ext JS Widgets
Ext JS Widgets

• About 80 examples come with the Ext JS SDK

• Try them yourself: http://dev.sencha.com/deploy/dev/examples/

• All widgets share a uniform API

• Any widget can be extended, features added.
Ext JS Grid Panel
Ext JS Grid Panel


   "...that grid is badass! It does everything.
    It cooks you dinner. It washes your car.
              It starches your shirts"




reddit.com
Ext JS Grid Panel

• Powerful and flexible table component

• Arguably the #1 reason people decide to use Ext JS
    (was for me)



• Out of the box: sorting, column resizing, column
  reordering, row drag drop, grouping, editing etc...

• Numerous extensions and plugins available
Ext JS Grid Panel




Note to self: Demo gridpanel
Ext JS Forms
Ext JS Forms

• Great for editing and entering data

• Available field types: text, password, number, file
  upload, text area, checkbox, radio, date, time.

• Form fields can use vtypes, to validate their value.
    alpha, alphanum, email, url


• Validation support on the entire form or individual
  fields.
Composite Fields
Form validation




form.isValid(); // false
Ext JS Forms
• Flexible validation error messages

    • Individual, side




    • Error summary
Ext JS Tree Panel
Ext JS Tree Panel

• Great for displaying hierarchical data, backed by an
  Ext.data.TreeStore

• Supports animation, checkbox selection model, node
  reordering

• Also supports the features of GridPanel, column resize,
  reorder, hide/show, sorting etc.
Ext JS Charts
Ext JS Charts

• New in Ext JS 4 (used to rely on YUI flash charts)

• Interactive X-browser charting package

• Falls back to VML for (IE6/IE7/IE8)

• Canvas support coming

• Rich interactivity, click, tooltips, animations
Charts Demo
Ext JS Class System
Ext JS Class System

• Uniform way of defining classes and inheritance

• Classes are defined as strings, meaning file load
  order does not matter.

• Mixins allow you to define reusable behavior that can
  be applied to multiple classes, achieving multiple
  inheritance

• Dynamic class loading via Ext.Loader
Defining a simple class


Ext.define(’MyWindowClass’, {
    requires : [’SomeOtherClass’, ...],
    mixins : [’Draggable’ ],

      myMethod : function() { ... }
});
Sample Ext Classes
Dynamic Loading


• Dynamic class loading via Ext.Loader

• Great for development and debugging purposes

• Use JSBuilder to build xx-all.js file

• Switch to combined and minified xx-all.js file for
  production.
Classic JS app, week 1

<html>
    <head>
        <title>My App</title>
        <link href="style.css" rel="stylesheet" type="text/css" />

       <script type="text/javascript" src="class1.js"></script>
       <script type="text/javascript" src="class2.js"></script>

        <script type="text/javascript" src="app.js"></script>
    </head>
    <body>
    </body>
</html>
Classic JS app, week 5
<html>
    <head>
        <title>My App</title>
        <link href="style.css" rel="stylesheet" type="text/css" />

       <script   type="text/javascript"   src="class1.js"></script>
       <script   type="text/javascript"   src="class2.js"></script>
       <script   type="text/javascript"   src="class3.js"></script>
       <script   type="text/javascript"   src="class4.js"></script>
       <script   type="text/javascript"   src="class5.js"></script>
       <script   type="text/javascript"   src="class6.js"></script>
       ...
       <script   type="text/javascript" src="class23.js"></script>

        <script type="text/javascript" src="app.js"></script>
    </head>
    <body>   </body>
</html>
Ext JS DataPackage
Benefits of Ext JS data package


• Uniform way of loading and writing data

• All UI components displaying data use stores and models

• UI components have no inherent knowledge about the
  data they display – clean separation of concerns
DataReader & Proxy

• Ext.data.Reader is used to parse data into a Model
  instance or into a Store, typically in response to an
  AJAX request.

• Built-in support for JSON and XML and arrays

• Proxies fetch raw, unformatted data from different
  types of sources. (HttpProxy, MemoryProxy, JSONP)
Model & Store

• A Model is a client side data model which encapsulates
  data corresponding to a single DB record

• A Model usually belongs to a Store and has a number of
  fields (e.g.                        )

• A Store encapsulates a client side cache of Model
  objects. Provides input data for GridPanel, ComboBox

• Store supports filtering, grouping, sorting etc.
Ext JS DataPackage
Complex App Using Stores


   http://dev.sencha.com/dep
           loy/ext-4.0.7-
   gpl/examples/sandbox/san
             dbox.html
Review: Web Desktop

• Again, built a powerful web app simulating a desktop
  interface

• No time spent inventing advanced CSS layouts.

• Drawback: We are tricking the user to think it is a real
  desktop. Might be disappointed if app behaves different
  than the native OS. (Ctrl-Z, Ctrl-S, etc.)
Ext JS Component Model
Component Model

• Ext.Component is the base class for all Ext components
• Example components:
    Ext.form.TextField
    Ext.TreePanel
    Ext.GridPanel
    Ext.Window


• Managed life cycle, template method hooks
    •   constructor
    •   initComponent
    •   onRender
    •   afterRender
    •   onDestroy
Component Plugins




• Ext Components can be augmented by plugins

• A plugin is any object with an init fn

• The host component calls init during its initialization,
  passing itself as the only reference
Component Plugins



• Example plugins:
    • Ext.grid.CellEditing
    • Ext.grid.RowEditing
    • Ext.grid.HeaderReorderer
    • Ext.grid.HeaderResizer


• Very neat and easy way of breaking out behavior into its
  own class
Defining a plugin


var myAwesomePlugin = {
    init : function(component) {
        // Do awesome stuff
    }
};
Using a plugin


Ext.create(’Ext.GridPanel’, {
    width : 500,
    height : 500,
    store : someDataStore,

      plugins: [new Ext.grid.CellEditing()]
});
Containers - Layout

• Containers can contain child components

• Choose from several built in layouts to produce complex
  layout structures. Nest as deep as you want.

• Example: Complex layout
Extending Components


• Very simple to extend existing components

• Add your own custom features and functionality

• Benefit from the Ext Component
  lifecycle, managed instantiation and destruction

• Bryntum Gantt chart extends Ext.TreePanel
Extending Components

Ext.define(’My.GanttChart’, {
    extend : ’Ext.GridPanel’,
    requires : [’My.TaskStore’],

      initComponent: function() {
          // Do stuff...
          this.callParent(arguments);
      },
      renderBars : function() { ... }
});
Custom Components




• Forum has a UX section for community extensions

• http://market.sencha.com

• Share, buy or sell your extensions
Popular Components
Community Extensions


• Example: Interactive SVG map
So, Ext JS sounds
      great, is there a catch?

• Slight learning curve, reason: big API.

• ext-all-debug.js     : 2.3Mb

• jquery1.7.1.js       : 240kb

• Helps if you know basic, JS/HTML/CSS
Unit Testing Ext apps


• Jasmine

• Selenium (tricky)

• Siesta

• PhantomJS (headless WebKit)
Additional Resources


• http://www.sencha.com/learn

• http://www.sencha.com/docs

• http://docs.sencha.com/ext-js/4-0/#!/guide

• http://www.sencha.com/forum/
Ext JS and JavaScript training




• Starting spring 2012 together with Informator

• For beginners or intermediate JS developers

• 1-3 days customized to your needs
Questions?



mats@bryntum.com

@bryntum

More Related Content

What's hot

What's hot (20)

XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)
 
Enhancing Spring MVC Web Applications Progressively with Spring JavaScript
Enhancing Spring MVC Web Applications Progressively with Spring JavaScriptEnhancing Spring MVC Web Applications Progressively with Spring JavaScript
Enhancing Spring MVC Web Applications Progressively with Spring JavaScript
 
WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013
 
10 Steps Not To Forget After Installing Drupal
10 Steps Not To Forget After Installing Drupal 10 Steps Not To Forget After Installing Drupal
10 Steps Not To Forget After Installing Drupal
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
Dangerous CSS
Dangerous CSSDangerous CSS
Dangerous CSS
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013
 
Extension Javascript
Extension JavascriptExtension Javascript
Extension Javascript
 
Dojo & HTML5
Dojo & HTML5Dojo & HTML5
Dojo & HTML5
 
Stupid Index Block Tricks
Stupid Index Block TricksStupid Index Block Tricks
Stupid Index Block Tricks
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
 
Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs
 
The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An Introduction
 
Webpack: What it is, What it does, Whether you need it
Webpack: What it is, What it does, Whether you need itWebpack: What it is, What it does, Whether you need it
Webpack: What it is, What it does, Whether you need it
 
WordPress Themes and Plugins
WordPress Themes and PluginsWordPress Themes and Plugins
WordPress Themes and Plugins
 
Java for XPages Development
Java for XPages DevelopmentJava for XPages Development
Java for XPages Development
 
Foundation vs Bootstrap - CC FE & UX
Foundation vs Bootstrap - CC FE & UXFoundation vs Bootstrap - CC FE & UX
Foundation vs Bootstrap - CC FE & UX
 

Similar to Building Rich Internet Applications with Ext JS

Extjs3.4 Migration Notes
Extjs3.4 Migration NotesExtjs3.4 Migration Notes
Extjs3.4 Migration Notes
SimoAmi
 
Developing components and extensions for ext js
Developing components and extensions for ext jsDeveloping components and extensions for ext js
Developing components and extensions for ext js
Mats Bryntse
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
Implemeting Sencha Ext JS in Drupal
 Implemeting Sencha Ext JS in Drupal Implemeting Sencha Ext JS in Drupal
Implemeting Sencha Ext JS in Drupal
drupalsydney
 

Similar to Building Rich Internet Applications with Ext JS (20)

Introduction to ExtJS and its new features
Introduction to ExtJS and its new featuresIntroduction to ExtJS and its new features
Introduction to ExtJS and its new features
 
Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6
 
Extjs3.4 Migration Notes
Extjs3.4 Migration NotesExtjs3.4 Migration Notes
Extjs3.4 Migration Notes
 
Developing components and extensions for ext js
Developing components and extensions for ext jsDeveloping components and extensions for ext js
Developing components and extensions for ext js
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
Ext JS Upgrade Adviser EA Launch
Ext JS Upgrade Adviser EA LaunchExt JS Upgrade Adviser EA Launch
Ext JS Upgrade Adviser EA Launch
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
 
Implemeting Sencha Ext JS in Drupal
 Implemeting Sencha Ext JS in Drupal Implemeting Sencha Ext JS in Drupal
Implemeting Sencha Ext JS in Drupal
 
WebsiteStructure
WebsiteStructureWebsiteStructure
WebsiteStructure
 
WebsiteStructure
WebsiteStructureWebsiteStructure
WebsiteStructure
 
Eclipse e4
Eclipse e4Eclipse e4
Eclipse e4
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
GateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web AppsGateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web Apps
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Building Rich Internet Applications with Ext JS

  • 1. Rich Web Applications With mats@bryntum.com @bryntum
  • 2. Agenda • Who am I? • What is Ext JS? • When (not) to use Ext JS • Ext Class system • Widgets, Grids, Forms, Trees • Dealing with data • Extending Ext JS classes
  • 3. Before we start #comday
  • 4. Mats Bryntse o 35+ yrs old o From Helsingborg, Sweden o Background: o Worked 7 years as SW consultant: C#, ASP.NET, C o Found Ext JS in 2007, never looked back o Started Bryntum 2009, http://bryntum.com o I create JS components & test tools for Ext JS. o Twitter: @bryntum
  • 5. What is Ext JS? Ext JS is a client-side JavaScript framework for building rich web applications.
  • 6. Who has heard of Ext JS before?
  • 7. Ext JS background & facts • Began as YUI-Ext in 2006, 1.0 in 2007, now v4.1. • Company called Sencha, based in Palo Alto • Funded by Sequoia Capital (Google, Yahoo!, Paypal, YouTube) • Community Forum >300k members
  • 8. Ext JS features • Full UI application development suite • Powerful & extensible widgets: grids, forms, trees, charts • Data package, class system, MVC, Ext Designer • Familiar Windows-like look & feel, layout engine
  • 9. When to use Ext JS • Write web applications not web sites • Typically LOB applications, intranet apps etc. • Data intensive apps, gathering, displaying, filtering
  • 10. When not to use Ext JS • Write web sites • Write sites or apps targeting mobile/tablet. Instead use Sencha Touch or jQuery Mobile • If SEO matters • If initial page load time is critical
  • 11. Traditional web dev pain points • Too much time spent defining the user interface • Browsers quirks => need hacks => uncertainty • Multiple authors of UI code => inconsistent look & feel. => easy to end up with function soup • JS/UI unit testing often an afterthought • Sounds familiar?
  • 12. Benefits of using Ext JS • Simple, config-driven, standardized API • X-browser support, incl. our favorite IE6 • Spend time writing business logic, not HTML tags or complex CSS layouts. • Less time spent chasing X-browser bugs
  • 13. Hello World in Firebug
  • 14. JavaScript centric • Ext JS is all about OOP in JavaScript • Only basic HTML/CSS skills required • The Hello World oneliner: • Generated 50+ DOM nodes. • No time was spent developing the user interface • A typical Ext JS application uses a single HTML page (SPI)
  • 16. Ext JS Widgets • About 80 examples come with the Ext JS SDK • Try them yourself: http://dev.sencha.com/deploy/dev/examples/ • All widgets share a uniform API • Any widget can be extended, features added.
  • 17. Ext JS Grid Panel
  • 18. Ext JS Grid Panel "...that grid is badass! It does everything. It cooks you dinner. It washes your car. It starches your shirts" reddit.com
  • 19. Ext JS Grid Panel • Powerful and flexible table component • Arguably the #1 reason people decide to use Ext JS (was for me) • Out of the box: sorting, column resizing, column reordering, row drag drop, grouping, editing etc... • Numerous extensions and plugins available
  • 20. Ext JS Grid Panel Note to self: Demo gridpanel
  • 22. Ext JS Forms • Great for editing and entering data • Available field types: text, password, number, file upload, text area, checkbox, radio, date, time. • Form fields can use vtypes, to validate their value. alpha, alphanum, email, url • Validation support on the entire form or individual fields.
  • 25. Ext JS Forms • Flexible validation error messages • Individual, side • Error summary
  • 26. Ext JS Tree Panel
  • 27. Ext JS Tree Panel • Great for displaying hierarchical data, backed by an Ext.data.TreeStore • Supports animation, checkbox selection model, node reordering • Also supports the features of GridPanel, column resize, reorder, hide/show, sorting etc.
  • 29. Ext JS Charts • New in Ext JS 4 (used to rely on YUI flash charts) • Interactive X-browser charting package • Falls back to VML for (IE6/IE7/IE8) • Canvas support coming • Rich interactivity, click, tooltips, animations
  • 31. Ext JS Class System
  • 32. Ext JS Class System • Uniform way of defining classes and inheritance • Classes are defined as strings, meaning file load order does not matter. • Mixins allow you to define reusable behavior that can be applied to multiple classes, achieving multiple inheritance • Dynamic class loading via Ext.Loader
  • 33. Defining a simple class Ext.define(’MyWindowClass’, { requires : [’SomeOtherClass’, ...], mixins : [’Draggable’ ], myMethod : function() { ... } });
  • 35. Dynamic Loading • Dynamic class loading via Ext.Loader • Great for development and debugging purposes • Use JSBuilder to build xx-all.js file • Switch to combined and minified xx-all.js file for production.
  • 36. Classic JS app, week 1 <html> <head> <title>My App</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="class1.js"></script> <script type="text/javascript" src="class2.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> </body> </html>
  • 37. Classic JS app, week 5 <html> <head> <title>My App</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="class1.js"></script> <script type="text/javascript" src="class2.js"></script> <script type="text/javascript" src="class3.js"></script> <script type="text/javascript" src="class4.js"></script> <script type="text/javascript" src="class5.js"></script> <script type="text/javascript" src="class6.js"></script> ... <script type="text/javascript" src="class23.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> </body> </html>
  • 39. Benefits of Ext JS data package • Uniform way of loading and writing data • All UI components displaying data use stores and models • UI components have no inherent knowledge about the data they display – clean separation of concerns
  • 40. DataReader & Proxy • Ext.data.Reader is used to parse data into a Model instance or into a Store, typically in response to an AJAX request. • Built-in support for JSON and XML and arrays • Proxies fetch raw, unformatted data from different types of sources. (HttpProxy, MemoryProxy, JSONP)
  • 41. Model & Store • A Model is a client side data model which encapsulates data corresponding to a single DB record • A Model usually belongs to a Store and has a number of fields (e.g. ) • A Store encapsulates a client side cache of Model objects. Provides input data for GridPanel, ComboBox • Store supports filtering, grouping, sorting etc.
  • 43. Complex App Using Stores http://dev.sencha.com/dep loy/ext-4.0.7- gpl/examples/sandbox/san dbox.html
  • 44. Review: Web Desktop • Again, built a powerful web app simulating a desktop interface • No time spent inventing advanced CSS layouts. • Drawback: We are tricking the user to think it is a real desktop. Might be disappointed if app behaves different than the native OS. (Ctrl-Z, Ctrl-S, etc.)
  • 46. Component Model • Ext.Component is the base class for all Ext components • Example components: Ext.form.TextField Ext.TreePanel Ext.GridPanel Ext.Window • Managed life cycle, template method hooks • constructor • initComponent • onRender • afterRender • onDestroy
  • 47. Component Plugins • Ext Components can be augmented by plugins • A plugin is any object with an init fn • The host component calls init during its initialization, passing itself as the only reference
  • 48. Component Plugins • Example plugins: • Ext.grid.CellEditing • Ext.grid.RowEditing • Ext.grid.HeaderReorderer • Ext.grid.HeaderResizer • Very neat and easy way of breaking out behavior into its own class
  • 49. Defining a plugin var myAwesomePlugin = { init : function(component) { // Do awesome stuff } };
  • 50. Using a plugin Ext.create(’Ext.GridPanel’, { width : 500, height : 500, store : someDataStore, plugins: [new Ext.grid.CellEditing()] });
  • 51. Containers - Layout • Containers can contain child components • Choose from several built in layouts to produce complex layout structures. Nest as deep as you want. • Example: Complex layout
  • 52. Extending Components • Very simple to extend existing components • Add your own custom features and functionality • Benefit from the Ext Component lifecycle, managed instantiation and destruction • Bryntum Gantt chart extends Ext.TreePanel
  • 53. Extending Components Ext.define(’My.GanttChart’, { extend : ’Ext.GridPanel’, requires : [’My.TaskStore’], initComponent: function() { // Do stuff... this.callParent(arguments); }, renderBars : function() { ... } });
  • 54. Custom Components • Forum has a UX section for community extensions • http://market.sencha.com • Share, buy or sell your extensions
  • 56. Community Extensions • Example: Interactive SVG map
  • 57. So, Ext JS sounds great, is there a catch? • Slight learning curve, reason: big API. • ext-all-debug.js : 2.3Mb • jquery1.7.1.js : 240kb • Helps if you know basic, JS/HTML/CSS
  • 58. Unit Testing Ext apps • Jasmine • Selenium (tricky) • Siesta • PhantomJS (headless WebKit)
  • 59. Additional Resources • http://www.sencha.com/learn • http://www.sencha.com/docs • http://docs.sencha.com/ext-js/4-0/#!/guide • http://www.sencha.com/forum/
  • 60. Ext JS and JavaScript training • Starting spring 2012 together with Informator • For beginners or intermediate JS developers • 1-3 days customized to your needs