SlideShare a Scribd company logo
ExtJS Events By Aaron Conran
Events Events describe  when  a certain action happens. This could be a user action, a response to an Ajax call, etc. Events also provide us with some information about  what  occurred via arguments
Events The DOM model describes numerous events which may occur to an HTMLElement. Such as: mousedown mouseover click select blur focus change http://www.w3.org/TR/DOM-Level-2-Events/events.html
Event Registration Please avoid DOM level 0 event registration by NOT placing your event handlers in-line <a href=“” onclick=“return myFunction()”>link</a> Event handling like this has been deprecated for some time and using it in dynamic applications may cause memory leaks!
Event-handling ExtJS normalizes event-handling differences across the browsers. To add an event handler to an event we use the following syntax. Ext.fly(‘myElement’).on(‘click’, myFunction, scope); To remove an event handler to an event we use the following syntax. Ext.fly(‘myElement’).un(‘click’, myFunction, scope);
Event handling When using Ext.Element all standard HTMLElement events are exposed. The called function will receive 2 arguments. event – This is Ext.EventObject which normalizes event information cross-browser target – This is an HTMLElement which desribes the  target  which was clicked.
Events All classes which expose  events  inherit from Ext.util.Observable. Observable is a design pattern which allows a  subject object  to notify zero to many  subscriber objects The subscribers are not guaranteed to be called in any order http://en.wikipedia.org/wiki/Observer_pattern
Events Events  tell their subscribers about  when  and  what  happened. Subscribers can react appropriately without knowing  why  an event occurred. Refer to the ExtJS Documentation when you want to know what arguments you will be passed. (Click Events link at the top of each class)
Example ExtJS Docs complete public event complete  Fires after editing is complete and any changed value has been written to the underlying field. Subscribers will be called with the following parameters:  this : Editor value : Mixed The current field value startValue : Mixed The original field value This event is defined by Editor.
this .editItemNumber.on('complete',   this .commitRecord,    this ); commitRecord :  function ( ed ,  value , oldValue) { var  boundElDom =  ed .boundEl.dom; var  recordId = boundElDom.parentNode.id; var  currRecord =  this .store.getById(recordId); var  cn = boundElDom.className; currRecord.set(cn,  value ); currRecord.commit(); this .refresh(); },
ExtJS Events Many ExtJS classes expose  before events  which will allow you to cancel an action by returning false. Ex: ds.on(‘beforeload’, function(ds, opts) {return false;}); In a real situation we would make an intelligent decision given ds and opts to cancel the load event.
What’s next? We will be covering how to create our own observable classes. This will allow us to easily communicate between other classes. For a full discourse on how event handling works in the DOM read Events and Event Handling in  JavaScript:  The Definitive Guide  (p388 – 436) All of these cross-browser discrepancies are eliminated by ExtJS
Next Class If you don’t want to read the whole chapter, look up the following concepts. Dom Level 2 Event Handling Propagation Bubbling Default action Related target

More Related Content

PPT
Ext Js Events
PPT
Ext J S Observable
PPTX
Web technology javascript
PDF
ReRxSwift
PPTX
State, Life cycle, Methods & Events
PPTX
mediator
PPT
Air Drag And Drop
PPT
Diving in the Flex Data Binding Waters
Ext Js Events
Ext J S Observable
Web technology javascript
ReRxSwift
State, Life cycle, Methods & Events
mediator
Air Drag And Drop
Diving in the Flex Data Binding Waters

What's hot (8)

PPTX
My.setting tutorial
PPTX
User controls
PPT
Digesting jQuery
PPTX
Colegio nacional dario guevara mayorga
PPT
Flex data binding pitfalls: 10 common misuses and mistakes
PDF
Introj Query Pt2
PPTX
Real Object-Oriented Programming: Empirically Validated Benefits of the DCI P...
PPTX
Mysql: Tools & Gui
My.setting tutorial
User controls
Digesting jQuery
Colegio nacional dario guevara mayorga
Flex data binding pitfalls: 10 common misuses and mistakes
Introj Query Pt2
Real Object-Oriented Programming: Empirically Validated Benefits of the DCI P...
Mysql: Tools & Gui
Ad

Similar to Ext Js Events (20)

PPT
Ext oo
PDF
Ext JS in Action 1st Edition Jesus Garcia
PDF
ODP
Event handling using jQuery
PPTX
Basics of Ext JS
PPTX
Promises, promises, and then observables
PPT
Event
PDF
Introducing jQuery
PDF
ax2012
PPTX
Javascript And J Query
PPTX
Jquery introduce
PDF
Javascript Browser Events.pdf
PPTX
J Query Presentation of David
PPT
Document_Object_Model_in_javaScript..................................ppt
PPTX
jQuery basics for Beginners
PDF
Event Driven Architecture
PPTX
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
PDF
Introduction to CQRS & Commended
PDF
Javascript libraries
PPTX
Mastering the Lightning Framework - Part 2 - JF Paradis.pptx
Ext oo
Ext JS in Action 1st Edition Jesus Garcia
Event handling using jQuery
Basics of Ext JS
Promises, promises, and then observables
Event
Introducing jQuery
ax2012
Javascript And J Query
Jquery introduce
Javascript Browser Events.pdf
J Query Presentation of David
Document_Object_Model_in_javaScript..................................ppt
jQuery basics for Beginners
Event Driven Architecture
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
Introduction to CQRS & Commended
Javascript libraries
Mastering the Lightning Framework - Part 2 - JF Paradis.pptx
Ad

More from jason hu 金良胡 (20)

PPT
新员工培训
PDF
Javascript 闭包
PDF
Windows Powershell En
PDF
正则表达式
PDF
Work In Japan
PDF
Linuxcommand
PDF
PDF
Asp.Net运行时
PDF
PDF
PPT
Sql2005 Xml
PDF
Ms Ajax Dom Element Class
PDF
Ms Ajax Dom Element Class
PDF
Ms Ajax Number And Error Extensions
PDF
Ms Ajax Dom Event Class
PDF
Ms Ajax Date And Boolean Extensions
PDF
Ms Ajax Array Extensions
PDF
Ms Ajax String And Object Extensions
PPT
Ext Js Dom Navigation
PPT
Java Script Introduction
新员工培训
Javascript 闭包
Windows Powershell En
正则表达式
Work In Japan
Linuxcommand
Asp.Net运行时
Sql2005 Xml
Ms Ajax Dom Element Class
Ms Ajax Dom Element Class
Ms Ajax Number And Error Extensions
Ms Ajax Dom Event Class
Ms Ajax Date And Boolean Extensions
Ms Ajax Array Extensions
Ms Ajax String And Object Extensions
Ext Js Dom Navigation
Java Script Introduction

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
sap open course for s4hana steps from ECC to s4
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

Ext Js Events

  • 1. ExtJS Events By Aaron Conran
  • 2. Events Events describe when a certain action happens. This could be a user action, a response to an Ajax call, etc. Events also provide us with some information about what occurred via arguments
  • 3. Events The DOM model describes numerous events which may occur to an HTMLElement. Such as: mousedown mouseover click select blur focus change http://www.w3.org/TR/DOM-Level-2-Events/events.html
  • 4. Event Registration Please avoid DOM level 0 event registration by NOT placing your event handlers in-line <a href=“” onclick=“return myFunction()”>link</a> Event handling like this has been deprecated for some time and using it in dynamic applications may cause memory leaks!
  • 5. Event-handling ExtJS normalizes event-handling differences across the browsers. To add an event handler to an event we use the following syntax. Ext.fly(‘myElement’).on(‘click’, myFunction, scope); To remove an event handler to an event we use the following syntax. Ext.fly(‘myElement’).un(‘click’, myFunction, scope);
  • 6. Event handling When using Ext.Element all standard HTMLElement events are exposed. The called function will receive 2 arguments. event – This is Ext.EventObject which normalizes event information cross-browser target – This is an HTMLElement which desribes the target which was clicked.
  • 7. Events All classes which expose events inherit from Ext.util.Observable. Observable is a design pattern which allows a subject object to notify zero to many subscriber objects The subscribers are not guaranteed to be called in any order http://en.wikipedia.org/wiki/Observer_pattern
  • 8. Events Events tell their subscribers about when and what happened. Subscribers can react appropriately without knowing why an event occurred. Refer to the ExtJS Documentation when you want to know what arguments you will be passed. (Click Events link at the top of each class)
  • 9. Example ExtJS Docs complete public event complete Fires after editing is complete and any changed value has been written to the underlying field. Subscribers will be called with the following parameters: this : Editor value : Mixed The current field value startValue : Mixed The original field value This event is defined by Editor.
  • 10. this .editItemNumber.on('complete', this .commitRecord, this ); commitRecord : function ( ed , value , oldValue) { var boundElDom = ed .boundEl.dom; var recordId = boundElDom.parentNode.id; var currRecord = this .store.getById(recordId); var cn = boundElDom.className; currRecord.set(cn, value ); currRecord.commit(); this .refresh(); },
  • 11. ExtJS Events Many ExtJS classes expose before events which will allow you to cancel an action by returning false. Ex: ds.on(‘beforeload’, function(ds, opts) {return false;}); In a real situation we would make an intelligent decision given ds and opts to cancel the load event.
  • 12. What’s next? We will be covering how to create our own observable classes. This will allow us to easily communicate between other classes. For a full discourse on how event handling works in the DOM read Events and Event Handling in JavaScript: The Definitive Guide (p388 – 436) All of these cross-browser discrepancies are eliminated by ExtJS
  • 13. Next Class If you don’t want to read the whole chapter, look up the following concepts. Dom Level 2 Event Handling Propagation Bubbling Default action Related target