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.

Slides:



Advertisements
Similar presentations
The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
Advertisements

JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
Event Handling. Overview How to listen (and not listen) for events Creating a utility library (and why you should) Typology of events Pairing event listeners.
The Web Warrior Guide to Web Design Technologies
Tutorial 15 Working with the Event Model. XP Objectives Compare the IE and W3C event models Study how events propagate under both event models Write a.
JavaScript, Third Edition
XP Tutorial 8 New Perspectives on JavaScript, Comprehensive1 Working with the Event Model Creating a Drag-and-Drop Shopping Cart.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Events.
CST JavaScript Validating Form Data with JavaScript.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
The Document Object Model. Goals Understand how a JavaScript can communicate with the web page in which it “lives.” Understand how to use dot notation.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Dynamic Documents With JavaScript.
Execution Environment for JavaScript " Java Script Window object represents the window in which the browser displays documents. " The Window object provides.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 JavaScript and HTML Documents.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
JavaScript, Part 3 Instructor: Charles Moen CSCI/CINF 4230.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
DOM Events. JS Events Outline About Events – Introduction – Registering events – Getting information from events Event order/phases – Preventing default.
Navigating the DOM with ExtJS By Aaron Conran. Document Object Model The Document Object Model or DOM is a standard to represent HTML, XHTML and other.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
Events DOM Event Model. HTML Events "on" + event name attribute value is javascript javascript runs 1st return false to STOP browser event (if any)
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Dimiter Kunchev.  JavaScript library written by Sam Stephenson   Adds object oriented techniques  Provides.
JavaScript, Fourth Edition Chapter 4 Manipulating the Browser Object Model.
Creating Elements with Ext.DomHelper By Aaron Conran.
Review of the DOM Node properties and methods Some ways of accessing nodes Appending, copying and removing nodes Event handling – Inline – Scripting –
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Thursday, August 6 th, 2015 Instructor: Craig Duckett Event Handling.
DOM Events. JS Events Outline About Events – Introduction – Registering events – Getting information from events Event order/phases – Preventing default.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 5. JavaScript and HTML Documents.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
4. Events are where it happens! Bear Bibeault Yehuda Katz.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
1 Javascript CS , Spring What is Javascript ? Browser scripting language  Dynamic page creation  Interactive  Embedded into HTML pages.
WaveMaker Visual AJAX Studio 4.0 Training Java Script Events.
Host Objects: Browsers and the DOM
ExtJS Ext.util.Observable By Aaron Conran. Observer Design Pattern An observable object can notify any number of observers who would like to know when.
Events Event Handling in JavaScript SoftUni Team Technical Trainers Software University
Modern JavaScript Develop And Design Instructor’s Notes Chapter 8 – Event Handling Modern JavaScript Design And Develop Copyright © 2012 by Larry Ullman.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
Introduction 1.HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document. 2.Events are normally used in combination.
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 6. Dynamic Documents With JavaScript.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Jozef Goetz contribution, © by Pearson Education, Inc. All Rights Reserved.
Introduction to JavaScript Events Instructor: Sergey Goldman 1.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 5 Host Objects: Browsers.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
REEM ALMOTIRI Information Technology Department Majmaah University.
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
Applied Component I Unit II Introduction of java-script
Introduction to JavaScript Events
JavaScript and Events.
JavaScript and HTML Documents
Events Comp 205 Fall 2017.
CHAPTER 6 EVENTS. CHAPTER 6 EVENTS WHAT IS AN EVENT?
Presentation transcript:

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

Event Registration Please avoid DOM level 0 event registration by NOT placing your event handlers in-line link 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

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