extjs getEl() 什么意思?
展开全部
getEl( ) : Ext.Element
返回所属的{@link Ext.Element}。通常这是一个<...
返回所属的Ext.Element。通常这是一个<DIV>元素,由onRender方法所创建,但也有可能是autoEl配置项所制定的那个。Returns the Ext.Element which encapsulates this Component. This will usually be a <DIV> element created by the class's onRender method, but that may be overridden using the autoEl config.
该组件若是未完全渲染完毕的话,这个元素是不存在的。The Element will not be available until this Component has been rendered.
要登记改组件的DOM事件(相当于组件本身的Observable事件而言),就要这样加入事件侦听器(如render事件): To add listeners for DOM events to this Component (as opposed to listeners for this Component's own Observable events), perform the adding of the listener in a render event listener:
new Ext.Panel({
title: 'The Clickable Panel',
listeners: {
render: function(p) {
// Append the Panel to the click handler's argument list.
p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
}
}
});
参数项:
返回值:
Ext.Element
包含该组件的元素对象。The Element which encapsulates this Component.
返回所属的{@link Ext.Element}。通常这是一个<...
返回所属的Ext.Element。通常这是一个<DIV>元素,由onRender方法所创建,但也有可能是autoEl配置项所制定的那个。Returns the Ext.Element which encapsulates this Component. This will usually be a <DIV> element created by the class's onRender method, but that may be overridden using the autoEl config.
该组件若是未完全渲染完毕的话,这个元素是不存在的。The Element will not be available until this Component has been rendered.
要登记改组件的DOM事件(相当于组件本身的Observable事件而言),就要这样加入事件侦听器(如render事件): To add listeners for DOM events to this Component (as opposed to listeners for this Component's own Observable events), perform the adding of the listener in a render event listener:
new Ext.Panel({
title: 'The Clickable Panel',
listeners: {
render: function(p) {
// Append the Panel to the click handler's argument list.
p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
}
}
});
参数项:
返回值:
Ext.Element
包含该组件的元素对象。The Element which encapsulates this Component.
追问
var el = Ext.get(this.getEl());
会获得一个什么值?
追答
还是获得包含它的面板的元素Ext,Element
过程如下:
1、this.getEl() 获取引用名;
2、Ext.get(引用名) 获取还是它本身
el是Element类的简写,extjs中每个元素都被封装成对应的Element对象,以实现跨浏览器的兼容性,并提供更多扩展功能。
例如:
获得一个元素的横坐标:el.getX()
参考资料: 1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询