更新2.2到3.3.1后的sencha框架问题

时间:2011-02-24 15:00:21

标签: javascript extjs

在ExtJS更新2.2到3.3.1之后,我遇到了一个无法解决的问题。

我认为它是一个创建的TreePanel。但是“this”对象中没有childNodes:

  

错误:cs为空

renderChildren : function(suppressEvent){
    if(suppressEvent !== false){
        this.fireEvent('beforechildrenrendered', this);
    }
    var cs = this.childNodes;
    for(var i = 0, len = cs.length; i < len; i++){
        cs[i].render(true);
    }
    this.childrenRendered = true;
}, 

我无法弄清楚导致此问题的原因,无法找到谁正在调用此命令。

2 个答案:

答案 0 :(得分:0)

this可能是window。检查函数调用(或附加事件)时是否正确设置了上下文(this)。

答案 1 :(得分:0)

通过查看堆栈找到它:

MapPanel.js (rad 77)

代码:

        var toc = new MyPanel.Toc( {
            map :map,
            border :false
        });
        tocPanel.add(toc);
        //toc.update(); //When i comment out these it works. 
        //tocPanel.doLayout();
  

“TreePanel在呈现之前必须有一个根节点。” class=Ext.tree.TreePanel

可能是这个吗?