显示一个window窗口,点击按钮打开新窗口,窗口中有树:
-
<link rel="stylesheet" type="text/css" href="plugins/extjs/ext-3.4.0/resources/css/ext-all.css" />
-
-
<script type="text/javascript" src="plugins/extjs/ext-3.4.0/adapter/ext/ext-base.js"></script>
-
<script type="text/javascript" src="plugins/extjs/ext-3.4.0/ext-all.js"></script>
-
-
-
<script type="text/javascript" src="test1.js"></script>
- // 显示一个窗口
-
function showWindow(){
-
var btn = new Ext.Button({text:"New Window"});
-
btn.on("click", function(){
-
var win = new Ext.Window({width:200, height:200});
-
win.show();
-
});
-
var win = new Ext.Window({
-
width:400,
-
height:300,
-
title:"My Ext Window",
-
maximizable:true,
-
-
buttons:[{text:"Create Tree Window", listeners:{
-
click:function(){
-
//alert(1111);
-
//创建一棵树,创建一个窗口
-
var tree = new Ext.tree.TreePanel({
-
title: "Tree Test",
-
width:500,
-
height:300,
-
root: new Ext.tree.AsyncTreeNode({
-
text: "根节点",
-
children: [{
-
text: "子节点1",
-
children:[{text:"孙节点1",leaf:true}]
-
},{
-
text: "子节点2", leaf:true
-
}]
-
})
-
});
-
var win = new Ext.Window({
-
width:400,height:350,title:"Simple window",
-
items:[tree]
-
});
-
win.show();
-
}
-
}},btn],
-
title:"My Ext Window"
-
});
-
win.show();
-
}
-
//onready需要接受一个回调函数
-
Ext.onReady(showWindow);
阅读(546) | 评论(0) | 转发(0) |