SlideShare uma empresa Scribd logo
1 de 43
Introdução Ext JS 4 Bruno Tavares
Ext JS 4
Desenvolvimento de Interfaces RIA Componentes, Widgets Integração com Dados Utilitários
Overview Componentes
Ext.panel.Panel
Ext.onReady(function() { Ext.create('Ext.panel.Panel', { title   : 'Hello',         html    : '<p>World!</p>',         width   : 200,         renderTo: Ext.getBody()     }); });
Ext.window.Window
Ext.create('Ext.window.Window', { title   : 'Hello',     height  : 200,     width   : 400 }).show();
Ext.grid.Panel
Ext.create('Ext.grid.Panel', { title   : 'Simpsons',     height  : 200,     width   : 400,     renderTo: Ext.getBody(),     store   : Ext.data.StoreManager.lookup('simpsonsStore'),     columns : [ 	{ header: 'Name',  dataIndex: 'name' }, { header: 'Email', dataIndex: 'email', flex: 1 }, { header: 'Phone', dataIndex: 'phone' }     ] });
Layouts
Ext.create('Ext.window.Window', { title   : 'Hello',     height  : 200,     width   : 400,     layout  : 'fit’,     items   : { xtype   : 'grid',         border  : false,         columns : [{header: 'World'}],         store   : Ext.create( 'Ext.data.ArrayStore', {}   )     } }).show();
Ext.create('Ext.window.Window', {     title       : 'Simple Form', layout      : 'anchor', defaultType : 'textfield', bodyPadding : 10,     width       : 350,     height      : 200, autoShow    : true,     renderTo    : Ext.getBody(),     items       : [{ fieldLabel  : 'First Name',         name        : 'first',         anchor      : '100%', allowBlank  : false     },{ fieldLabel  : 'Last Name',         name        : 'last',         anchor      : '-50', allowBlank  : false     }] });
Ext.create('Ext.panel.Panel', {     title   : 'Column Layout',     width   : 350,     height  : 250,     layout  :'column',     renderTo: Ext.getBody(),     items   : [{ title       : 'Column 1', columnWidth : .25     },{ title       : 'Column 2', columnWidth : .55     },{ title       : 'Column 3', columnWidth : .20     }] });
Ext.create('Ext.panel.Panel', {     width   : 500,     height  : 400,     title   : 'Border Layout',     layout  : 'border',     renderTo: Ext.getBody(),     items   : [{         title       : 'West Region is collapsible',         region      : 'west',         margins     : '5 0 0 0',         width       : 200,         collapsible : true,         split       : true     },{         title   : 'Center Region', region  : 'center',         margins : '5 0 0 0'     }] });
Ext.container.Viewport
Ext.create('Ext.container.Viewport', {     layout  : 'border',     items   : [{ xtype       : 'component',         region      : 'north',         html        : '<h1>Page Title</h1>', autoHeight  : true     }, {         region      : 'west',         collapsible : true, title       : 'Navigation',         width       : 150     },{ region      : 'center', xtype       : 'tabpanel', activeTab   : 0,         items       : { title   : 'Default Tab',             html    : 'The first tabapos;s content. '         }     }] });
Exercícios Componentes: Viewport, Panel West, TabPanel Center, Grid Layouts: Border, Accordion
Eventos e Listeners
Oscomponentesmonitoramseuseventos e emitemavisosquandoestessãodisparados. Listeners sãoouvintes, queficam “pendurados” em um evento, esperandoeleserdisparadoparaexecutarem.
Ext.create('Ext.panel.Panel', { title       : 'Hello',     width       : 200,     height      : 200,     collapsible : true,     renderTo    : Ext.getBody(), listeners   : { collapse: function(){ Ext.Msg.alert( 'Atenção!',  'Painel foi contraído!'             );         }     } });
grid.on('select', function(rowModel, record) { Ext.Msg.alert( 'Atenção', 'RegistroSelecionado: '+record.get('name'));     ); });
Exercícios
Estrutura de Aplicação Organização Consistência Ferramentas de Build
App.js Ext.application({ name: 'AM', appFolder: 'app', launch: function() { Ext.create('Ext.container.Viewport', { layout: 'fit', items: [                 { xtype: 'panel', title: 'Users',                     html : 'List of users will go here'                 }             ]         });     } });
Controller Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller', init: function() { console.log('Initialized Users! This happens before the Application launch function is called');     } });
Controller Ext.application({     ...     controllers: [ 'Users'     ],     ... });
Controller Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller', init: function() { this.control({ 'viewport > panel': {                 render: this.onPanelRendered             }         });     }, onPanelRendered: function() { console.log('The panel was rendered');     } });
Controller
View Ext.define('AM.view.user.List' ,{ extend: 'Ext.grid.Panel',     alias : 'widget.userlist', title : 'All Users’, initComponent: function() { this.store= {              ...	          }; this.columns= [ ...         ]; this.callParent(arguments);     } });
View Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller', views: [ 'user.List'     ], init: ... onPanelRendered: ... });
View Ext.application({     ... launch: function() { Ext.create('Ext.container.Viewport', { layout: 'fit', items: { xtype: 'userlist'             }         });     } });
Model e Store Ext.define('AM.store.Users', {     extend: 'Ext.data.Store', fields: ['name', 'email'],     data: [         {name: 'Ed',    email: 'ed@sencha.com'},         {name: 'Tommy', email: 'tommy@sencha.com'}     ] });
Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller',     stores: [ 'Users'     ],     ... });
Ext.define('AM.view.user.List' ,{ extend: 'Ext.grid.Panel',     alias : 'widget.userlist',     store: 'Users',     ... });
Ext.define('AM.model.User', {     extend: 'Ext.data.Model', fields: ['name', 'email'] }); Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller',     stores: ['Users'], models: ['User'],     ... }); Ext.define('AM.store.Users', {     extend: 'Ext.data.Store',     model: 'AM.model.User',     data: [         {name: 'Ed',    email: 'ed@sencha.com'},         {name: 'Tommy', email: 'tommy@sencha.com'}     ] });
Exercício Montar a estrutura Ext JS 4 no exerício anterior

Mais conteúdo relacionado

Mais procurados

Emerging tier 1 & tier 2
Emerging   tier 1 & tier 2Emerging   tier 1 & tier 2
Emerging tier 1 & tier 2matrix3g
 
Waja a-shahr-ramadan SDFS
Waja a-shahr-ramadan   SDFSWaja a-shahr-ramadan   SDFS
Waja a-shahr-ramadan SDFSAbu Abdirrahman
 
Cuecos! Capítulo Dos
Cuecos! Capítulo DosCuecos! Capítulo Dos
Cuecos! Capítulo DosRevulú
 
Competitive deck shortened version 3.16.12 final
Competitive deck shortened version 3.16.12   finalCompetitive deck shortened version 3.16.12   final
Competitive deck shortened version 3.16.12 finalElizabeth Morris Gerber
 
Bengali islam religion
Bengali islam religionBengali islam religion
Bengali islam religionNisreen Ly
 
Як досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкЯк досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкShtrih Sruleg
 

Mais procurados (13)

Index2
Index2Index2
Index2
 
14. add in db
14. add in db14. add in db
14. add in db
 
Emerging tier 1 & tier 2
Emerging   tier 1 & tier 2Emerging   tier 1 & tier 2
Emerging tier 1 & tier 2
 
Minishell
MinishellMinishell
Minishell
 
Waja a-shahr-ramadan SDFS
Waja a-shahr-ramadan   SDFSWaja a-shahr-ramadan   SDFS
Waja a-shahr-ramadan SDFS
 
فوائد الذكر وثمراته
فوائد الذكر وثمراتهفوائد الذكر وثمراته
فوائد الذكر وثمراته
 
Cuecos! Capítulo Dos
Cuecos! Capítulo DosCuecos! Capítulo Dos
Cuecos! Capítulo Dos
 
Competitive deck shortened version 3.16.12 final
Competitive deck shortened version 3.16.12   finalCompetitive deck shortened version 3.16.12   final
Competitive deck shortened version 3.16.12 final
 
Jquery Framework
Jquery FrameworkJquery Framework
Jquery Framework
 
Bengali islam religion
Bengali islam religionBengali islam religion
Bengali islam religion
 
Як досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворкЯк досвід компанії перетворився на фреймворк
Як досвід компанії перетворився на фреймворк
 
Introducción a Bolt
Introducción a BoltIntroducción a Bolt
Introducción a Bolt
 
Form refactoring
Form refactoringForm refactoring
Form refactoring
 

Destaque

Financial assistant evan vitale
Financial assistant evan vitaleFinancial assistant evan vitale
Financial assistant evan vitaleEvan Vitale
 
Storyboard Main Task
Storyboard Main TaskStoryboard Main Task
Storyboard Main Taskmillaleigh
 
Blogging and business !
Blogging and business !Blogging and business !
Blogging and business !Evan Vitale
 
Social Value in Somerset
Social Value in SomersetSocial Value in Somerset
Social Value in SomersetSWF
 
Meet Abe and John
Meet Abe and JohnMeet Abe and John
Meet Abe and JohnAlan Crean
 
Understanding the University Sector
Understanding the University SectorUnderstanding the University Sector
Understanding the University SectorSWF
 
South West Integrated Personal Commissioning Programme - Giving People Choice...
South West Integrated Personal Commissioning Programme - Giving People Choice...South West Integrated Personal Commissioning Programme - Giving People Choice...
South West Integrated Personal Commissioning Programme - Giving People Choice...SWF
 
アメブロFaceの顔認識システム
アメブロFaceの顔認識システムアメブロFaceの顔認識システム
アメブロFaceの顔認識システムTakahiko Teramoto
 
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察Kazuhiro Kosaka
 
William Mougayar Financial Securities Operations Conference Presentation
William Mougayar Financial Securities Operations Conference PresentationWilliam Mougayar Financial Securities Operations Conference Presentation
William Mougayar Financial Securities Operations Conference PresentationThe Business Blockchain
 
End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16AppDynamics
 
El siglo XVIII. Los Borbones en España.
El siglo XVIII. Los Borbones en España.El siglo XVIII. Los Borbones en España.
El siglo XVIII. Los Borbones en España.Javier Pérez
 
Archiving Web News (captioned)
Archiving Web News (captioned)Archiving Web News (captioned)
Archiving Web News (captioned)SvenAas
 

Destaque (17)

Financial assistant evan vitale
Financial assistant evan vitaleFinancial assistant evan vitale
Financial assistant evan vitale
 
Storyboard Main Task
Storyboard Main TaskStoryboard Main Task
Storyboard Main Task
 
Blogging and business !
Blogging and business !Blogging and business !
Blogging and business !
 
Social Value in Somerset
Social Value in SomersetSocial Value in Somerset
Social Value in Somerset
 
Meet Abe and John
Meet Abe and JohnMeet Abe and John
Meet Abe and John
 
AppNeta | APM
AppNeta | APMAppNeta | APM
AppNeta | APM
 
Understanding the University Sector
Understanding the University SectorUnderstanding the University Sector
Understanding the University Sector
 
Supreme-CompanyProfile
Supreme-CompanyProfileSupreme-CompanyProfile
Supreme-CompanyProfile
 
South West Integrated Personal Commissioning Programme - Giving People Choice...
South West Integrated Personal Commissioning Programme - Giving People Choice...South West Integrated Personal Commissioning Programme - Giving People Choice...
South West Integrated Personal Commissioning Programme - Giving People Choice...
 
Netflix in the cloud 2011
Netflix in the cloud 2011Netflix in the cloud 2011
Netflix in the cloud 2011
 
アメブロFaceの顔認識システム
アメブロFaceの顔認識システムアメブロFaceの顔認識システム
アメブロFaceの顔認識システム
 
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察
SWFバージョン4においての テキスト形式による コンパイル結果の違い及び JavaScriptでの その描画方法に関する考察
 
William Mougayar Financial Securities Operations Conference Presentation
William Mougayar Financial Securities Operations Conference PresentationWilliam Mougayar Financial Securities Operations Conference Presentation
William Mougayar Financial Securities Operations Conference Presentation
 
End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16End User Monitoring with AppDynamics - AppSphere16
End User Monitoring with AppDynamics - AppSphere16
 
Ppt
PptPpt
Ppt
 
El siglo XVIII. Los Borbones en España.
El siglo XVIII. Los Borbones en España.El siglo XVIII. Los Borbones en España.
El siglo XVIII. Los Borbones en España.
 
Archiving Web News (captioned)
Archiving Web News (captioned)Archiving Web News (captioned)
Archiving Web News (captioned)
 

Introdução ext js 4