SlideShare a Scribd company logo
Want to Use Ext JS Components with
Angular 2?
Here’s How to Increase the Power
of Your Apps!
Marc Gusmano
Senior Sales Engineer
marc.gusmano@sencha.com
Have you ever wished you could use Sencha’s powerful Ext JS components in your
Angular 2 apps? Now you can. Learn about the new bridge we’ve created that
enables you to use the Ext JS grid, treegrid, pivot grid, calendar, charts, and other
components in your Angular 2 based apps.
We’ve integrated the frameworks, so Ext JS components recognize the Angular 2
directives and appropriately respond to events. If you’re an Angular 2 user, there is
no reason why you can’t use it to assemble the basic building blocks of an app and
then add the powerful Ext JS components to complete your data-centric, cross-
platform applications.
Come to this session to learn how to build a data-intensive, cross-platform app with
Ext JS 6.2 and Angular 2.
2
What Will We Be Doing?
So What is the Angular 2 Bridge for Ext JS?
• Enables the use of Ext JS Components, Layouts, Ext JS Classes within Angular 2
• Currently in Preview (no code available yet)
• Still need tooling (Sencha Cmd support)
• Works with Modern Toolkit
• Uses Ext JS Theme (no tooling currently)
• We need your feedback on this! marc.gusmano@sencha.com
3
Starter Options for an Angular 2 Application
• Angular.io – getting started https://angular.io/docs/ts/latest/quickstart.html
• Angular-cli https://cli.angular.io/
• Reddit – helpful GitHub repos https://www.reddit.com/r/Angular2/
4
Demo –
Angular-cli
import { Component } from '@angular/core';
@Component({
selector: 'simple',
template: `
<h1>{{title}}</h1>
<button
class="theButton"
[disabled]="isDisabled"
(click)="onClick($event)">
{{title}}
</button>
`,
styles: [`
.theButton {
font-size: 32px;
}
`]
})
export class SimpleComponent {
title = 'app works!';
isDisabled = false;
private onClick(event) {
console.log(event)
this.title = 'I was clicked and disabled';
this.isDisabled = true;
}
}
An Angular2 Component
using TypeScript
(Angular 2 – 101)
• import
• @component
- selector, template, styles
- templateUrl, stylesUrl
• export class
• [name] is syntax for a property
• (name) is syntax for an event
• {{name}} is binding syntax
Demo –
a simple Angular 2 component
if (o.alias != undefined &&
o.alias.substring(0, 6) == 'widget' &&
o.alias.substring(7).indexOf('.') == -1 &&
o.alias.indexOf('actionsheet') == -1 &&
o.alias.indexOf('audio') == -1 &&
o.alias.indexOf('axis') == -1 &&
o.alias.indexOf('carouselindicator') == -1 &&
o.alias.substring(7).indexOf('item') == -1 &&
o.alias.substring(7).indexOf('cell') == -1 &&
o.alias.substring(7).indexOf('column') == -1 &&
o.alias.substring(7).indexOf('row') == -1 &&
o.alias.substring(7).indexOf('sparkline') == -1 &&
o.alias.substring(7).indexOf('pivotconfig') == -1 &&
o.alias.indexOf(',') == -1
)
8
All ‘primary’ Visual Components, except for…
import { Component } from '@angular/core';
@Component({
selector: '',
styles: [``],
template: `
<x-grid fitToParent=true
[config]="gridConfig">
</x-grid>
`
})
export class BridgeHomeComponent {
gridConfig= {
title: 'Bridge Home',
columns: [
{text:'Name', width:100, dataIndex:'name'},
{text:'Email Address', flex:1, dataIndex:'email'},
{text:'Phone Number', width:150, dataIndex:'phone'}
],
store: {
fields: ['name', 'email', 'phone'],
data: [
{name:'Lisa', email:'lisa@simpsons.com', phone:'555-111-1224'},
{name:'Bart', email:'bart@simpsons.com', phone:'555-222-1234'},
{name:'Homer', email:'homer@simpsons.com', phone:'555-222-1244'},
{name:'Marge', email:'marge@simpsons.com', phone:'555-222-1254'}
]
}
};
}
An Angular2 Component
that uses the Ext JS Grid
• x- is the prefix for an Ext JS
component
• Following the x- is the xtype (x-grid)
• General property called [config]
- All components have this property
• Also all have fitToParent property
• Also all have (ready) event
import { Component } from '@angular/core';
@Component({
selector: '',
styles: [``],
template: `
<x-grid fitToParent=true
[columns]="gridcolumns"
[store]="gridstore"
(select)="onGridSelect($event)"
(activate)="onGridActivate($event)"
(ready)="gridReady($event)">
</x-grid>
`
})
export class BridgeHomeComponent {
gridcolumns = [
{text:'Name', width:100, dataIndex:'name'},
{text:'Email Address', flex:1, dataIndex:'email'},
{text:'Phone Number', width:150, dataIndex:'phone'}
];
gridstore = {
fields: ['name', 'email', 'phone'],
data: [
{name:'Lisa', email:'lisa@simpsons.com', phone:'555-111-1224'},
{name:'Bart', email:'bart@simpsons.com', phone:'555-222-1234'},
{name:'Homer', email:'homer@simpsons.com', phone:'555-222-1244'},
{name:'Marge', email:'marge@simpsons.com', phone:'555-222-1254'}
]
};
private onGridSelect({record}) {alert(record.data.name);}
private onGridActivate(event) {console.log(event);}
private onGridReady(theGrid) {console.log(theGrid.x);}
}
An Angular2 Component
that uses the Ext JS Grid
• All components have an Angular 2
property for each Ext JS config
- For example: [columns]
• All events are also available
- For example: (select)
• (ready) event is used to extract the
underlying Ext JS component
- Available as the ‘x’ property of the passed
parameter
Demo –
Ext JS Grid in Angular 2
@Component({
selector: '',
styles: [``],
template: `
<x-container fitToParent=true [layout]="'vbox'">
<x-panel [margin]="'20 20 20 20'" [title]="header">
<x-selectfield
[config]="selectfieldConfig"
[options]='selectfieldOptions'
(change)='onSelectfieldSelect($event)'>
</x-selectfield>
</x-panel>
<x-pivotgrid
[flex]="'1'"
[title] ='pivotTitle'
[config]='pivotgridConfig'
(ready)="readyPivotGrid($event)"
(pivotdone)="onPivotgridPivotDone($event)">
</x-pivotgrid>
<x-cartesian
[flex]="'1'”
[config]='cartesianConfig'
(ready)="readyCartesian($event)">
</x-cartesian>
</x-container>
`
})
Using the Ext JS Layout System
• vbox, hbox, flex, etc.
• Containment (the ‘items’ collection)
import {xclass} from 'angular2-extjs';
export class SalesStore extends xclass {
constructor (createConfig: any) {
let className: any = 'SalesStore';
let extend: any = 'Ext.data.ArrayStore';
let defineConfig: any = {
alias: 'store.sales',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'assets/sales.json',
reader: {
type: 'json',
rootProperty: 'rows'
}
},
filters: [
function(item) {
return item.get('year') >= 2012;
}
],
fields: [
{name: 'orderid', type: 'int'},
{name: 'salesperson', type: 'string'},
{name: 'country', type: 'string'},
{name: 'orderdate', type: 'date', dateFormat: 'd/m/Y'},
{name: 'amount', type: 'int'}
]
};
super(className, extend, defineConfig, createConfig);
return;
}
}
Creating non-visual components
(like stores and models)
• Import ‘xclass’
• Extend ‘xclass’
• Populate ‘className’
• Populate ‘extend’
• Populate 'defineConfig’
• Call the ‘xclass’ base class
Demo –
An Angular 2 app with Ext
JS
• Angular-cli starter
• Angular-cli application with Ext JS
15
Development and Production payloads
Development and Production payloads
Q & A
Question & Answer Session
SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to Increase the Power of Your Apps! - Marc Gusmano

More Related Content

PPTX
Ext JS Architecture Best Practices - Mitchell Simeons
Sencha
 
PDF
Workshop 8: Templating: Handlebars, DustJS
Visual Engineering
 
PPTX
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
PPTX
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
Sencha
 
PPTX
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Sencha
 
PDF
Angular Directives from Scratch
Christian Lilley
 
PDF
jQuery in 15 minutes
Simon Willison
 
PPTX
Academy PRO: React native - navigation
Binary Studio
 
Ext JS Architecture Best Practices - Mitchell Simeons
Sencha
 
Workshop 8: Templating: Handlebars, DustJS
Visual Engineering
 
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
Sencha
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Sencha
 
Angular Directives from Scratch
Christian Lilley
 
jQuery in 15 minutes
Simon Willison
 
Academy PRO: React native - navigation
Binary Studio
 

What's hot (20)

PDF
Difference between java script and jquery
Umar Ali
 
PDF
Sane Async Patterns
TrevorBurnham
 
PDF
Workshop 6: Designer tools
Visual Engineering
 
PPTX
AngularJS Directives
Eyal Vardi
 
PPT
JQuery introduction
NexThoughts Technologies
 
PPTX
jQuery PPT
Dominic Arrojado
 
PPTX
jQuery from the very beginning
Anis Ahmad
 
ODP
Introduction to jQuery
manugoel2003
 
KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
PDF
Learning jQuery in 30 minutes
Simon Willison
 
PDF
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
 
PDF
Workshop 18: CSS Animations & cool effects
Visual Engineering
 
PPTX
JavaScript and jQuery Basics
Kaloyan Kosev
 
ODP
Drupal Best Practices
manugoel2003
 
PPTX
Academy PRO: React native - building first scenes
Binary Studio
 
ODP
Session 2- day 3
Vivek Bhusal
 
PPTX
Getting the Most Out of jQuery Widgets
velveeta_512
 
PPT
A Short Introduction To jQuery
Sudar Muthu
 
PDF
Prototype & jQuery
Remy Sharp
 
Difference between java script and jquery
Umar Ali
 
Sane Async Patterns
TrevorBurnham
 
Workshop 6: Designer tools
Visual Engineering
 
AngularJS Directives
Eyal Vardi
 
JQuery introduction
NexThoughts Technologies
 
jQuery PPT
Dominic Arrojado
 
jQuery from the very beginning
Anis Ahmad
 
Introduction to jQuery
manugoel2003
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
Learning jQuery in 30 minutes
Simon Willison
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
 
Workshop 18: CSS Animations & cool effects
Visual Engineering
 
JavaScript and jQuery Basics
Kaloyan Kosev
 
Drupal Best Practices
manugoel2003
 
Academy PRO: React native - building first scenes
Binary Studio
 
Session 2- day 3
Vivek Bhusal
 
Getting the Most Out of jQuery Widgets
velveeta_512
 
A Short Introduction To jQuery
Sudar Muthu
 
Prototype & jQuery
Remy Sharp
 
Ad

Similar to SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to Increase the Power of Your Apps! - Marc Gusmano (20)

PDF
An introduction to Angular2
Apptension
 
PPTX
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
PDF
Angular2 with type script
Ravi Mone
 
PPTX
Angular2 for Beginners
Oswald Campesato
 
PPTX
An evening with Angular 2
Mike Melusky
 
PPTX
Angular2 + rxjs
Christoffer Noring
 
PDF
Angular 2 overview in 60 minutes
Loiane Groner
 
PPTX
Angular 2 with typescript
Tayseer_Emam
 
PDF
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
PPTX
An afternoon with angular 2
Mike Melusky
 
PPTX
Angular2
Oswald Campesato
 
PDF
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
PPTX
Angular js 2
Ran Wahle
 
PDF
Angular 2 - The Next Framework
Commit University
 
PDF
Angular2 Development for Java developers
Yakov Fain
 
PPTX
Moving From AngularJS to Angular 2
Exilesoft
 
PPTX
Ext Web Components - Dev Week 2019
Sandeep Adwankar
 
PDF
Angular 2 for Java Developers
Yakov Fain
 
PPTX
Angular 2 with TypeScript
Shravan Kumar Kasagoni
 
PDF
Angular 2 Essential Training
Patrick Schroeder
 
An introduction to Angular2
Apptension
 
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
Angular2 with type script
Ravi Mone
 
Angular2 for Beginners
Oswald Campesato
 
An evening with Angular 2
Mike Melusky
 
Angular2 + rxjs
Christoffer Noring
 
Angular 2 overview in 60 minutes
Loiane Groner
 
Angular 2 with typescript
Tayseer_Emam
 
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
An afternoon with angular 2
Mike Melusky
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
Angular js 2
Ran Wahle
 
Angular 2 - The Next Framework
Commit University
 
Angular2 Development for Java developers
Yakov Fain
 
Moving From AngularJS to Angular 2
Exilesoft
 
Ext Web Components - Dev Week 2019
Sandeep Adwankar
 
Angular 2 for Java Developers
Yakov Fain
 
Angular 2 with TypeScript
Shravan Kumar Kasagoni
 
Angular 2 Essential Training
Patrick Schroeder
 
Ad

More from Sencha (20)

PDF
Breathe New Life into Your Existing JavaScript Applications with Web Components
Sencha
 
PDF
Ext JS 6.6 Highlights
Sencha
 
PDF
Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...
Sencha
 
PDF
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
 
PDF
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha
 
PDF
Sencha Roadshow 2017: What's New in Sencha Test
Sencha
 
PDF
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha
 
PDF
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha
 
PDF
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha
 
PDF
Sencha Roadshow 2017: Mobile First or Desktop First
Sencha
 
PDF
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha
 
PDF
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
Sencha
 
PDF
Learn Key Insights from The State of Web Application Testing Research Report
Sencha
 
PPTX
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
Sencha
 
PPT
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
Sencha
 
PPT
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
Sencha
 
PPT
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
 
PPTX
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
Sencha
 
PPTX
Building Ext JS Using HATEOAS - Jeff Stano
Sencha
 
PPTX
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
Sencha
 
Breathe New Life into Your Existing JavaScript Applications with Web Components
Sencha
 
Ext JS 6.6 Highlights
Sencha
 
Sencha Roadshow 2017: BufferedStore Internals featuring eyeworkers interactiv...
Sencha
 
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha
 
Sencha Roadshow 2017: What's New in Sencha Test
Sencha
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha
 
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha
 
Sencha Roadshow 2017: Mobile First or Desktop First
Sencha
 
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha
 
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
Sencha
 
Learn Key Insights from The State of Web Application Testing Research Report
Sencha
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
Sencha
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
Sencha
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
Sencha
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
 
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
Sencha
 
Building Ext JS Using HATEOAS - Jeff Stano
Sencha
 
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
Sencha
 

Recently uploaded (20)

PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
CIFDAQ
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
PDF
Test Bank, Solutions for Java How to Program, An Objects-Natural Approach, 12...
famaw19526
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Captain IT
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
CIFDAQ's Token Spotlight: SKY - A Forgotten Giant's Comeback?
CIFDAQ
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
Test Bank, Solutions for Java How to Program, An Objects-Natural Approach, 12...
famaw19526
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Software Development Company | KodekX
KodekX
 
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Captain IT
 

SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to Increase the Power of Your Apps! - Marc Gusmano

  • 1. Want to Use Ext JS Components with Angular 2? Here’s How to Increase the Power of Your Apps! Marc Gusmano Senior Sales Engineer [email protected]
  • 2. Have you ever wished you could use Sencha’s powerful Ext JS components in your Angular 2 apps? Now you can. Learn about the new bridge we’ve created that enables you to use the Ext JS grid, treegrid, pivot grid, calendar, charts, and other components in your Angular 2 based apps. We’ve integrated the frameworks, so Ext JS components recognize the Angular 2 directives and appropriately respond to events. If you’re an Angular 2 user, there is no reason why you can’t use it to assemble the basic building blocks of an app and then add the powerful Ext JS components to complete your data-centric, cross- platform applications. Come to this session to learn how to build a data-intensive, cross-platform app with Ext JS 6.2 and Angular 2. 2 What Will We Be Doing?
  • 3. So What is the Angular 2 Bridge for Ext JS? • Enables the use of Ext JS Components, Layouts, Ext JS Classes within Angular 2 • Currently in Preview (no code available yet) • Still need tooling (Sencha Cmd support) • Works with Modern Toolkit • Uses Ext JS Theme (no tooling currently) • We need your feedback on this! [email protected] 3
  • 4. Starter Options for an Angular 2 Application • Angular.io – getting started https://angular.io/docs/ts/latest/quickstart.html • Angular-cli https://cli.angular.io/ • Reddit – helpful GitHub repos https://www.reddit.com/r/Angular2/ 4
  • 6. import { Component } from '@angular/core'; @Component({ selector: 'simple', template: ` <h1>{{title}}</h1> <button class="theButton" [disabled]="isDisabled" (click)="onClick($event)"> {{title}} </button> `, styles: [` .theButton { font-size: 32px; } `] }) export class SimpleComponent { title = 'app works!'; isDisabled = false; private onClick(event) { console.log(event) this.title = 'I was clicked and disabled'; this.isDisabled = true; } } An Angular2 Component using TypeScript (Angular 2 – 101) • import • @component - selector, template, styles - templateUrl, stylesUrl • export class • [name] is syntax for a property • (name) is syntax for an event • {{name}} is binding syntax
  • 7. Demo – a simple Angular 2 component
  • 8. if (o.alias != undefined && o.alias.substring(0, 6) == 'widget' && o.alias.substring(7).indexOf('.') == -1 && o.alias.indexOf('actionsheet') == -1 && o.alias.indexOf('audio') == -1 && o.alias.indexOf('axis') == -1 && o.alias.indexOf('carouselindicator') == -1 && o.alias.substring(7).indexOf('item') == -1 && o.alias.substring(7).indexOf('cell') == -1 && o.alias.substring(7).indexOf('column') == -1 && o.alias.substring(7).indexOf('row') == -1 && o.alias.substring(7).indexOf('sparkline') == -1 && o.alias.substring(7).indexOf('pivotconfig') == -1 && o.alias.indexOf(',') == -1 ) 8 All ‘primary’ Visual Components, except for…
  • 9. import { Component } from '@angular/core'; @Component({ selector: '', styles: [``], template: ` <x-grid fitToParent=true [config]="gridConfig"> </x-grid> ` }) export class BridgeHomeComponent { gridConfig= { title: 'Bridge Home', columns: [ {text:'Name', width:100, dataIndex:'name'}, {text:'Email Address', flex:1, dataIndex:'email'}, {text:'Phone Number', width:150, dataIndex:'phone'} ], store: { fields: ['name', 'email', 'phone'], data: [ {name:'Lisa', email:'[email protected]', phone:'555-111-1224'}, {name:'Bart', email:'[email protected]', phone:'555-222-1234'}, {name:'Homer', email:'[email protected]', phone:'555-222-1244'}, {name:'Marge', email:'[email protected]', phone:'555-222-1254'} ] } }; } An Angular2 Component that uses the Ext JS Grid • x- is the prefix for an Ext JS component • Following the x- is the xtype (x-grid) • General property called [config] - All components have this property • Also all have fitToParent property • Also all have (ready) event
  • 10. import { Component } from '@angular/core'; @Component({ selector: '', styles: [``], template: ` <x-grid fitToParent=true [columns]="gridcolumns" [store]="gridstore" (select)="onGridSelect($event)" (activate)="onGridActivate($event)" (ready)="gridReady($event)"> </x-grid> ` }) export class BridgeHomeComponent { gridcolumns = [ {text:'Name', width:100, dataIndex:'name'}, {text:'Email Address', flex:1, dataIndex:'email'}, {text:'Phone Number', width:150, dataIndex:'phone'} ]; gridstore = { fields: ['name', 'email', 'phone'], data: [ {name:'Lisa', email:'[email protected]', phone:'555-111-1224'}, {name:'Bart', email:'[email protected]', phone:'555-222-1234'}, {name:'Homer', email:'[email protected]', phone:'555-222-1244'}, {name:'Marge', email:'[email protected]', phone:'555-222-1254'} ] }; private onGridSelect({record}) {alert(record.data.name);} private onGridActivate(event) {console.log(event);} private onGridReady(theGrid) {console.log(theGrid.x);} } An Angular2 Component that uses the Ext JS Grid • All components have an Angular 2 property for each Ext JS config - For example: [columns] • All events are also available - For example: (select) • (ready) event is used to extract the underlying Ext JS component - Available as the ‘x’ property of the passed parameter
  • 11. Demo – Ext JS Grid in Angular 2
  • 12. @Component({ selector: '', styles: [``], template: ` <x-container fitToParent=true [layout]="'vbox'"> <x-panel [margin]="'20 20 20 20'" [title]="header"> <x-selectfield [config]="selectfieldConfig" [options]='selectfieldOptions' (change)='onSelectfieldSelect($event)'> </x-selectfield> </x-panel> <x-pivotgrid [flex]="'1'" [title] ='pivotTitle' [config]='pivotgridConfig' (ready)="readyPivotGrid($event)" (pivotdone)="onPivotgridPivotDone($event)"> </x-pivotgrid> <x-cartesian [flex]="'1'” [config]='cartesianConfig' (ready)="readyCartesian($event)"> </x-cartesian> </x-container> ` }) Using the Ext JS Layout System • vbox, hbox, flex, etc. • Containment (the ‘items’ collection)
  • 13. import {xclass} from 'angular2-extjs'; export class SalesStore extends xclass { constructor (createConfig: any) { let className: any = 'SalesStore'; let extend: any = 'Ext.data.ArrayStore'; let defineConfig: any = { alias: 'store.sales', autoLoad: true, proxy: { type: 'ajax', url: 'assets/sales.json', reader: { type: 'json', rootProperty: 'rows' } }, filters: [ function(item) { return item.get('year') >= 2012; } ], fields: [ {name: 'orderid', type: 'int'}, {name: 'salesperson', type: 'string'}, {name: 'country', type: 'string'}, {name: 'orderdate', type: 'date', dateFormat: 'd/m/Y'}, {name: 'amount', type: 'int'} ] }; super(className, extend, defineConfig, createConfig); return; } } Creating non-visual components (like stores and models) • Import ‘xclass’ • Extend ‘xclass’ • Populate ‘className’ • Populate ‘extend’ • Populate 'defineConfig’ • Call the ‘xclass’ base class
  • 14. Demo – An Angular 2 app with Ext JS
  • 15. • Angular-cli starter • Angular-cli application with Ext JS 15 Development and Production payloads
  • 17. Q & A Question & Answer Session