组件类提供了许多生命周期事件。当组件创建时,这些激活,渲染,销毁等等事件被激活。所有这些事件都可以通过使用监听器属性或使用on方法来进行处理。大多数这些生命周期事件实际上都是在ext.abstractcomponent类中定义的。下表描述了一些事件。

 Ext.onReady(function() {
var panel = Ext.create("Ext.panel.Panel", {
renderTo: Ext.getBody(),
items: [
Ext.create("Ext.Component", {
html: "Raw Component",
itemId: "comp",
listeners: {
activate: function() {
console.log("acticate");
},
added: function () {
console.log("added");
},
afterrender: function () {
console.log("afterrender");
},
beforeactivate: function () {
console.log("beforeactivate");
},
beforedeactivate: function () {
console.log("beforedeactivate");
},
beforerender: function () {
console.log("beforerender");
},
beforeshow: function () {
console.log("beforeshow");
},
beforedestroy: function () {
console.log("beforedestroy");
},
destroy: function () {
console.log("destroy");
},
render: function () {
console.log("render");
},
show: function () {
console.log("show");
},
beforehide: function () {
console.log("beforehide");
},
hide: function () {
console.log("hide");
},
enable: function () {
console.log("enable");
},
disable: function () {
console.log("disable");
},
removed: function () {
console.log("removed");
}
}
})
]
}); console.log("******Calling disable");
panel.getComponent("comp").disable();
console.log("******Calling enable");
panel.getComponent("comp").enable();
console.log("******Calling hide");
panel.getComponent("comp").hide();
console.log("******Calling show");
panel.getComponent("comp").show();
console.log("******Calling destroy");
panel.getComponent("comp").destroy();
});

在上面代码中我们使用侦听器块注册了事件。在呈现组件之后,我们调用诸如启用、禁用、显示、隐藏或销毁这些方法来理解事件处理序列。这是这段代码的输出。

Ext.Component事件的更多相关文章

  1. 谈谈Ext JS的组件——组件基类:Ext.Component

    概述 Ext.Component是所有Ext组件的基类,这在Ext.Component的API中第一句话就提到了.然后第二段说明了它包含的基本功能:隐藏/显示.启用/禁用以及尺寸控制等.除了以上这些基 ...

  2. ExtJS学习之路第二步:Ext.Component 和 Ext.dom.Element 的区别

    让我们来初步的探讨下Ext.Component和Ext.Element的区别. jQuery偏重于DOM元素的操作 1.每一个HTML页面都有一个层次分明的DOM树模型,浏览器中的所有内容都有相应的D ...

  3. Extjs 继承Ext.Component自定义组件

    //自定义HTML组件 Ext.define('MyCmp', { extend: 'Ext.Component', renderTpl: [ '<h1 class="title&qu ...

  4. [转载]Extjs中的dom,Ext.Element和Ext.Component对象的关系

    原文地址:http://www.cnblogs.com/lwzz/archive/2011/01/30/1948106.html   Ext.Element对象是对dom对象的封装,目的是为了跨平台以 ...

  5. 99.ext afteredit事件详解

    转自:http://www.jcodecraeer.com/a/jquery_js_ajaxjishu/2012/0524/203.html 1 摘要 grid.on(afteredit,afterE ...

  6. Ext JS 5的声明式事件监听

    在前文<在Ext JS 5使用ViewControllers>中,简单的介绍了Ext JS 5的一项重要改进——声明式事件监听.在本文,将深度探讨如何使用声明式事件监听啦简化应用程序的视图 ...

  7. spring boot: 一般注入说明(五) @Component, application event事件为Bean与Bean之间通信提供了支持

    spring的事件,为Bean与Bean之间通信提供了支持,当一个Bean处理完成之后,希望另一个Bean知道后做相应的事情,这时我们就让另外一个Bean监听当前Bean所发送的事件. spring的 ...

  8. ExtJS关于组件Component生命周期

    extjs组件生命周期大体分为3个阶段:初始化.渲染.销毁. 第一阶段:初始化 初始化工作开始于组件的诞生,所有必须的配置设定.事件注册.预渲染处理等都在此时进行. 1.应用组件的配置: 当初始化一个 ...

  9. 转: Ext拖拽分析

    整个Ext架构中组件是其重要的组成部分,除了少部分(如树的结点)的界面表现元素不是在这样的一个体系中,大部分的页面表现元素都被绑定在这个体系之中,下面从这个体系的最底层即在这个继承体系的最高层进行研究 ...

随机推荐

  1. 最新开源DBLayer,原来数据库操作可以这么简单

    DBLayer,我最近开源的数据库轻量级orm框架,目前支持sqlserver.mysql.oracle, 特别做了分页的封装. 这个框架从七八年前开始逐渐升级而来,也经历了不少项目,希望可以将大家从 ...

  2. Ajax 跨域提交表单

    跨域提交表单,前端ajax不用做任何修改, 只需要在后端调用的方法里面添加一行代码即可. .NET 版 HttpContext.Response.AddHeader("Access-Cont ...

  3. springmvc 之 Controller

    一.简介 在SpringMVC 中,控制器Controller 负责处理由DispatcherServlet 分发的请求,它把用户请求的数据经过业务处理层处理之后封装成一个Model ,然后再把该Mo ...

  4. sql 注入命令大全

    1.判断有无注入点 ; and 1=1 and 1=2 2.猜表一般的表的名称无非是admin adminuser user pass password 等.. and 0<>(selec ...

  5. react实现双向绑定

    双向绑定功能是在项目中比较常见的一个需求,传统的js实现方式是添加监听函数的方式,Vue框架实现很简单,因为它本身就是基于双向绑定实现的,接下来我将讲解一下如何使用react实现双向绑定的功能是 首先 ...

  6. phpstorm注册码

    用户名:Learn Programming License key:(包括LICENSE BEGIN和LICENSE END部分) ===== LICENSE BEGIN =====63758-120 ...

  7. 既然函数也是对象,那么为什么this不指向普通函数?

    function a(){ var b=1; function exp(){ alert(this.b); } exp(); } var b=2; a(); 既然函数是对象,且exp是在a中运行的,那 ...

  8. AJAX数据请求

    ajax数据请求需要四个步骤:(请求文本内容) 1.创建XMLHttpRequest对象: 2.打开与服务起的链接: 3.发送给服务器: 4.响应就绪. <!DOCTYPE html> & ...

  9. Javascript 类继承

    Js继承 JavaScript并不是真正面向对象的语言,是基于对象的,没有类的概念. 要想实现继承,可以用js的原型prototype机制或者用apply和call方法去实现 /** 声明一个基础父类 ...

  10. Android各种Manager

    一.PowerManager 主要是用来控制电源状态,设置屏幕状态,和电池待机状态 PowerManager  pm = ((PowerManager)getSystemService(POWER_S ...