事件不会在extjs中的浮动容器或组件上被触发

时间:2017-01-27 06:36:35

标签: javascript extjs components onclicklistener floating

我添加了一个浮动容器,在里面我添加了一个组件,如下所示,

var me = this;
var lastTab = me.getLastTabInTabPanel();
var iconContainer = me.down('#iconContainer');
if (iconContainer == null) {
    iconContainer = Ext.create('Ext.panel.Panel', {
        id: 'iconContainer',
        floating: true,
        shadow: false,
        listeners: {
            click: this.valIconClicked,
            scope: this
        },
        style: 'margin-left:280px;',
        items: [
            {
                xtype: 'component',
                id: 'valIcon',
                cls: 'valuation-tool-specview',
                height: 33,
                width: 26,
                listeners: {
                    click: this.valIconClicked,
                    scope: this
                }
            }
        ]
    });
}
iconContainer.showBy(lastTab, 'tl-tr');//, [-2, 0]
点击事件没有被解雇,我错过了什么吗?

1 个答案:

答案 0 :(得分:3)

组件没有点击事件。但是你可以将听众附加到他们的元素点击,如下所示:

listeners: {
    click: {
        element: 'el',
        scope: this,
        fn: this.valIconClicked
   }
}