日期:2014-05-16  浏览次数:20351 次

extjs4.1 树形菜单问题
JScript code

var Root = Ext.create("Ext.tree.Panel");
Ext.Ajax.timeout = 60 * 60 * 60;
Ext.data.Connection.timeout = 60 * 60 * 60;
Ext.data.proxy.Server.timeout = 60 * 60 * 60;
var treeNode = [];
var webNode = {
    text: "网站相关",
    children: [
        {
            text: "网站首页",
            leaf: true,
            id: "index"/*,
            handler: function () {
                window.open("/", "_blank");
            }*/
        }, {
            text: "网站基本信息",
            leaf: true,
            id: "basicInfo"/*,
            handler: function () {
                //MainPanel.add(createPanel()).show();
                //MainPanel.doLayout();
            }*/
        }
    ]
};
treeNode.push(webNode);
var cmsNode = {
    text: "信息网",
    children: [
        {
            text: "网站首页",
            leaf: true,
            id: "index"/*,
            handler: function () {
                window.open("/", "_blank");
            }*/
        }, {
            text: "文章管理",
            leaf: true,
            id: "ArticleManage"/*,
            handler: function () {
                //MainPanel.add(createArticlePanel()).show();
                //MainPanel.doLayout();
            }*/
        }
    ]
};
treeNode.push(cmsNode);
var store = Ext.create('Ext.data.TreeStore', {
    root: {
        expanded: true,
        children: treeNode
    }
});
Root = Ext.create("Ext.tree.Panel", {
    title: "功能列表",
    rootVisible: false,
    store: store,
    listeners: {
        itemclick: function (view, record) {
            if (record.raw.handler) {
                record.raw.handler();
            } else {
                ExtAlert("该节点未注册点击事件");
            }
        }
    }
});



上面定义了两个菜单,每个菜单有两个子节点
现在的问题是
第一次展开一个父节点时,不管展开哪一 个,都没有错误
第二次展开时,不管展开哪一个,都报错a[b] is undefined

求指点

------解决方案--------------------
我来了,给我吧