Extjs4树节点单击错误

Extjs4树节点单击错误,extjs4,treepanel,Extjs4,Treepanel,我在extjs4中工作。我已经创建了treeview作为- Ext.define('Balaee.view.qb.qbquestion.tree1', { extend: 'Ext.tree.Panel', title: 'Simple Tree', width: 200, id:'tree1', height: 150, alias : 'widget.tree1', store:'qb.qbquestionStore', di

我在extjs4中工作。我已经创建了treeview作为-

Ext.define('Balaee.view.qb.qbquestion.tree1', {

    extend: 'Ext.tree.Panel',
    title: 'Simple Tree',
    width: 200,
   id:'tree1',
    height: 150,

    alias : 'widget.tree1',
    store:'qb.qbquestionStore',
    displayField: 'text',
    rootVisible : true,
    multiSelect : true,
    valueField:'id',
    renderTo: Ext.getBody(),}),
通过服务器发送的Json正确连接到上述树面板。但当我试图点击树节点时,它在mozilla firefox中给我的错误是“TypeError:listener.fireFn未定义”,在chrome中给我的错误是“Uncaught TypeError:Cannot call method'apply'of undefined”。此外,节点仅展开一次。 在ControllerforItemClick中,我编写了如下代码-

init : function() {
        this.control({
                'tree1':{
                     itemclick: {

                           fn: function (view, record, item, index, e) {

                           if(record.data.checked==true)
                               {
                                  console.log(record.data.id);   

                               }
                           }
                       },

那么我需要做什么更改来删除错误呢?

'tree1'
是一个不正确的选择器。要通过组件的id将事件处理程序附加到组件,请使用hashtag

this.control({
“树1”:{
更新 我错过了第
行别名:“widget.tree1”
。因此您的选择器是正确的

尝试将侦听器更改为:

'tree1':{
itemclick:函数(视图、记录、项目、索引、e){
if(record.data.checked==true)
{
console.log(record.data.id);
}
}
我认为您的代码中显示的侦听器格式不受支持