首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Extjs treePanel 没法展开

2013-04-20 
Extjs treePanel 无法展开在使用extjs中treePanel的时候,根节点无法展开子节点,如图所示:尝试了很多方法都

Extjs treePanel 无法展开
在使用extjs中treePanel的时候,根节点无法展开子节点,如图所示:
Extjs treePanel 没法展开

尝试了很多方法都不行,纠结了半天还不知道怎么办?求各位帮帮忙。谢谢。Extjs treePanel 没法展开

只是小改了下,你的代码没有任何问题,你按照下面的代码测试下。

function alertPanel() {
var btn = new Ext.Button({
text : 'new window'
});
btn.on('click', function() {
var ww = new Ext.Window({
height : 300,
width : 300
});
ww.show();
});
var obj = {
title : "myjs",
width : 700,
height : 600,
maximizable : true,
minimizable : true,
html : 'Hello,easyjf open source',
buttons : [{
text : 'treepanel',
listeners : {
click : function() {
var tree = new Ext.tree.TreePanel({
title : '树的测试',
height : 300,
width : 300,
expanded : true,
root : new Ext.tree.AsyncTreeNode({
text : "根节点",
children : [{
text : "Child 1",
leaf : true
}, {
text : "Child 2",
leaf : true


}]
})
});
var win = new Ext.Window({
title : "简单window窗口",
height : 400,
width : 300,
items : tree
})
win.add(new Ext.Panel({
title : "面板"
}));
win.show();

}
}
}, btn]
};
var win = new Ext.Window(obj);
return win
}

Ext.onReady(function(){
var w = alertPanel();
w.show();
})



[解决办法]

function alertPanel() {
    var btn = new Ext.Button({
                text : 'new window'
            });
    btn.on('click', function() {
                var ww = new Ext.Window({
                            height : 300,
                            width : 300
                        });
                ww.show();
            });
    var obj = {
        title : "myjs",
        width : 700,
        height : 600,
        maximizable : true,
        minimizable : true,
        html : 'Hello,easyjf open source',
        buttons : [{
                    text : 'treepanel',
                    listeners : {
                        'click' : function() {
                            var tree = new Ext.tree.TreePanel({
                                        title : '树的测试',
                                        height : 300,
                                        width : 300,


                                        expanded : true,
                                        root : {
                                                    text : "根节点",
                                                    children : [{
                                                                text : "Child 1",
                                                                leaf : true
                                                            }, {
                                                                text : "Child 2",
                                                                leaf : true
                                                            }]
                                                }
                                    });


                            var win = new Ext.Window({
                                        title : "简单window窗口",
                                        height : 400,
                                        width : 300,
                                        items : tree
                                    })
                            win.add(new Ext.Panel({
                                        title : "面板"
                                    }));
                            win.show();
                        }
                    }
                }, btn]
    };
    var win = new Ext.Window(obj);
    return win
}; 
Ext.onReady(function() {
var w = alertPanel();
    w.show();  
});



Extjs treePanel 没法展开

热点排行