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. 别致的语言GO(GO语言初涉)

    最近由于各种原因(好吧,其实是犯懒)已经许久没有再写新的博文了!最近正好在学习一门新的语言,所以正好记录一下自己的学习成果!最近利用每天晚上下班回来后的几小时,学习了Google开发的Go语言,算是对 ...

  2. Django----认证系统和auth模块

    COOKIE 与 SESSION 概念 cookie不属于http协议范围,由于http协议无法保持状态,但实际情况,我们却又需要“保持状态”,因此cookie就是在这样一个场景下诞生. cookie ...

  3. HDOJ HDU 1850 Being a Good Boy in Spring Festival

    Description 一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧 陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地 ...

  4. 关于SQL SERVER中的FLOAT转换为VARCHAR

    关于SQL SERVER中的FLOAT转换为VARCHAR 一个FLOAT型的字段,要转换为VARCHAR,可是小数点后面的都自动被删去了...后查得可以通过如下转换获得: SELECT CAST(C ...

  5. 部署不能产生class文件的问题

    项目clean和重新部署项目之后,还是不能产生class文件:查看“Problem”视图,是lib路径有问题,右击项目→“Build Path”→“Configure Build Path”,Libr ...

  6. Python全栈-magedu-2018-笔记11

    第三章 - Python 内置数据结构 简单选择排序 简单选择排序 属于选择排序 两两比较大小,找出极值(极大值或极小值)被放置在固定的位置,这个固定位置一般指的是某一端 结果分为升序和降序排列 降序 ...

  7. [No0000141]Outlook,设置全局已读回执

    Outlook,设置全局已读回执 文件->选项

  8. 用CountDownLatch提升请求处理速度

    countdownlatch是java多线程包concurrent里的一个常见工具类,通过使用它可以借助线程能力极大提升处理响应速度,且实现方式非常优雅.今天我们用一个实际案例和大家来讲解一下如何使用 ...

  9. 知乎改版api接口之scrapy自动登陆

    最近使用scrapy模拟登陆知乎,发现所有接口都发生变化了,包括验证码也发生了很大变化,通过抓包分析,记录下改版后的知乎模拟登陆,废话不多说,直接上代码,亲测有效 # -*- coding: utf- ...

  10. css样式重置样式

    html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, ci ...