Listeners and Event Domains

In Ext JS 4.2, the MVC event dispatcher was generalized with the introduction of event domains. These event domains intercepted events as they were fired and dispatched them to controllers controlled by selector matching. The “component” event domain had full component query selectors while the other domains had more limited selectors.

With Ext JS 5+, each ViewController creates an instance of a new type of event domain called the “view” event domain. This event domain allows ViewControllers to use the standard listen and control methods while limiting their scope implicitly to their view. It also adds a special selector to match the view itself:

Ext.define('MyApp.view.foo.FooController', {
extend: 'Ext.app.ViewController',
alias: 'controller.foo', control: {
'#': { // matches the view itself
collapse: 'onCollapse'
},
button: {
click: 'onAnyButtonClick'
}
}
});

The key difference between listeners and selectors can be seen above. The “button” selector will match any button in this view or any child view, irrespective of depth, even if that button belongs to a great-grandchild view. In other words, selector-based handlers do not respect encapsulation boundaries. This behavior is consistent with previous Ext.app.Controller behavior and can be a useful technique in limited situations.

Lastly, these event domains respect nesting and effectively “bubble” an event up the view hierarchy. That is to say, when an event fires, it’s first delivered to any standard listeners. Then, it’s delivered to its owning ViewController, followed by its parent ViewController (if any) on up the hierarchy. Eventually, the event is delivered to the standard “component” event domain to be handled by Ext.app.Controller-derived controllers.

http://wangyuelucky.blog.51cto.com/1011508/1610248/

Extjs event domain 研究的更多相关文章

  1. Javascript - ExtJs - 事件

    事件(ExtJs Event) Ext.Util.observable类  Ext.Util.observable是一个接口,为Ext组件的事件提供了支持,组件的事件不同于传统事件,所以需要有这么一套 ...

  2. Android斗地主棋牌游戏牌桌实现源码下载

    本次给大家分享下Android斗地主棋牌游戏牌桌实现源码下载如下: 为了节约内存资源,每张扑克牌都是剪切形成的,当然这也是当前编程的主流方法. 1.主Activity package com.biso ...

  3. Android --- 斗地主 [牌桌实现源码]

    1.主Activity <span style="font-size:18px;color:#3333ff;">package com.bison; import an ...

  4. 《javascript高级程序设计》 第23章 离线应用与客户端存储

    23.1 离线检测23.2 应用缓存23.3 数据存储 23.3.1 Cookie 23.3.2 IE 用户数据 23.3.3 Web 存储机制 23.3.4 IndexedDB   23.1 离线检 ...

  5. 《JavaScript高级程序设计》心得笔记-----第五篇章

    第二十二章 1.  安全的检测是使用:Object.prototype.toString.call(value); eg: function isArray(value){ return Object ...

  6. HTML5分析实战Web存储机制(Web Storage)

    Web Storage它是Key-Value在持久性数据存储的形式.Web Storage为了克服cookie把所引起的一些限制.当数据需要严格格控制client准时,没有必要不断地发回数据serve ...

  7. web storage 离线存储

    用来保存键值对数据,数据以属性的方式保存在storage实例对象上   可以用storage1.length来决定键值对的数量,但是无法决定数据的大小,storage1.remainingSpace可 ...

  8. 数据存储之Web存储(sessionStorage localStorage globalStorage )

    Web Storage 两个目标 提供一种在cookie之外的存储会话守数据的途径 提供一种存储大量可以跨会话存在的数据机制 最初的Web Storage规范包含两个对象 sessionStorage ...

  9. 【Linux】Cent OS 虚拟机开机自启动配置

    一次断电,导致实体机关机了,虚拟机也连不上去,只好手动来起来. 我想增加一下自启动,让硬件开机的时候,自动启动虚拟机: 其实是有办法的,尝试了一下,也成功了,这里简单标记下. virsh autost ...

随机推荐

  1. 我所知道的几种display:table-cell的应用

    .outer span {  display: table-cell; } 一.display:table-cell属性简述 display:table-cell属性指让标签元素以表格单元格的形式呈现 ...

  2. db2 reorg table failed处理

    概要: 当对一个表的结构进行改变后,需要reorg表,重新组织其目录统计信息,为数据库的访问计划提供信息,以便高效执行对其的操作. 对表作reorg操作,发生错误,通过db2 "? sql0 ...

  3. 查看线程的进程id

    import os from threading import Thread def f1(n): print(n) print('%d号线程的id是%s'%(n,os.getpid())) if _ ...

  4. 单链表实现n(n≥20)的阶乘

    n(n≥20)的阶乘 基本要求 数据的表示和存储: 累积运算的中间结果和最终的计算结果的数据类型要求是整型--这是问题本身的要求. 试设计合适的存储结构,要求每个元素或结点最多存储数据的3位数值. 数 ...

  5. Vue2 dist 目录下各个文件的区别

    vue2 经过 2.2 版本升级后, 文件变成了 8 个: vue.common.js vue.esm.js vue.js vue.min.js vue.runtime.common.js vue.r ...

  6. 使用graalvm.js调用promise

    前提 1.JDK1.8 2.引入jar包 <!--graalvm.js --> <dependency> <groupId>org.graalvm.js</g ...

  7. [development][thrift] RPC框架 thrift

    一: wiki:https://zh.wikipedia.org/wiki/Thrift 二: 来自IBM的介绍:https://www.ibm.com/developerworks/cn/java/ ...

  8. [hyperscan][pkg-config] hyperscan 从0到1路线图

    经过一系列的研究学习,知识储备之后,终于,可以开始研究hyperscan了. [knowledge][模式匹配] 字符匹配/模式匹配 正则表达式 自动机 [knowledge][perl][pcre] ...

  9. ascii码值

    ascii码值#0 空值 即null#8 退格键#13 回车键

  10. LeetCode 824 Goat Latin 解题报告

    题目要求 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase a ...