2014-10-09 68 views
0

在我们的4.2.2应用程序中,我们在容器上注册了一个点击事件,如下所示,但它在ExtJS 5中不起作用。任何想法?为什么ExtJS 5容器点击事件不再被解雇?

'afterrender': function(comp) { 
    comp.getEl().on({ 
     'click' : { 
      fn: function (el) { 
       this.fireEvent('click', comp); 
      }, 
      scope: comp 
     }, 
     'mouseover' : { 
      fn: function (el) { 
       el.target.style.cursor = "pointer"; 
      }, 
      scope: comp 
     } 
    }, comp); 
} 
+1

这件事情有怎样的'on'方法是使用您传递的......如果你脱下'comp'范围通过范围,它会工作。我建议重构这个具有个别'on'调用,并引用处理程序。 – incutonez 2014-10-09 02:45:55

+0

删除工作范围。谢谢!!! – 2014-10-09 16:04:48

回答

1

从“打开”呼叫的末尾删除范围“comp”。

BEFORE:

'afterrender': function(comp) { 
    comp.getEl().on({ 
     'click' : { 
      fn: function (el) { 
       this.fireEvent('click', comp); 
      }, 
      scope: comp 
     }, 
     'mouseover' : { 
      fn: function (el) { 
       el.target.style.cursor = "pointer"; 
      }, 
      scope: comp 
     } 
    }, comp); 
} 

AFTER:

'afterrender': function(comp) { 
    comp.getEl().on({ 
     'click' : { 
      fn: function (el) { 
       this.fireEvent('click', comp); 
      }, 
      scope: comp 
     }, 
     'mouseover' : { 
      fn: function (el) { 
       el.target.style.cursor = "pointer"; 
      }, 
      scope: comp 
     } 
    }); 
} 
+0

为什么我的投稿被拒绝?升级到ExtJS 5是一场噩梦,这似乎是一个有效的问题。我开车解决答案。现在我不能在堆栈溢出中提出问题,因为Sencha论坛经常是蹩脚的,我依赖它。请帮忙。 – 2014-10-30 18:00:12