Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99017
  • 博文数量: 34
  • 博客积分: 925
  • 博客等级: 准尉
  • 技术积分: 350
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-15 11:52
文章分类

全部博文(34)

文章存档

2011年(34)

我的朋友

分类: 系统运维

2011-08-30 13:58:44

显示一个window窗口,点击按钮打开新窗口,窗口中有树:


  1.     <link rel="stylesheet" type="text/css" href="plugins/extjs/ext-3.4.0/resources/css/ext-all.css" />
  2.     
  3.     <script type="text/javascript" src="plugins/extjs/ext-3.4.0/adapter/ext/ext-base.js"></script>
  4.     <script type="text/javascript" src="plugins/extjs/ext-3.4.0/ext-all.js"></script>
  5.     
  6.     
  7.     <script type="text/javascript" src="test1.js"></script>

  1. // 显示一个窗口
  2. function showWindow(){
  3.     var btn = new Ext.Button({text:"New Window"});
  4.         btn.on("click", function(){
  5.             var win = new Ext.Window({width:200, height:200});
  6.             win.show();
  7.         });
  8.     var win = new Ext.Window({
  9.         width:400,
  10.         height:300,
  11.         title:"My Ext Window",
  12.         maximizable:true,
  13.         
  14.         buttons:[{text:"Create Tree Window", listeners:{
  15.             click:function(){
  16.                 //alert(1111);
  17.                 //创建一棵树,创建一个窗口
  18.                 var tree = new Ext.tree.TreePanel({
  19.                     title: "Tree Test",
  20.                     width:500,
  21.                     height:300,
  22.                     root: new Ext.tree.AsyncTreeNode({
  23.                         text: "根节点",
  24.                         children: [{
  25.                             text: "子节点1",
  26.                             children:[{text:"孙节点1",leaf:true}]
  27.                         },{
  28.                             text: "子节点2", leaf:true
  29.                         }]
  30.                     })
  31.                 });
  32.                 var win = new Ext.Window({
  33.                     width:400,height:350,title:"Simple window",
  34.                     items:[tree]    
  35.                 });
  36.                 win.show();
  37.             }
  38.         }},btn],
  39.         title:"My Ext Window"
  40.     });
  41.     win.show();
  42. }
  43. //onready需要接受一个回调函数
  44. Ext.onReady(showWindow);
阅读(546) | 评论(0) | 转发(0) |
0

上一篇:extJS事件驱动

下一篇:extJS 常用组件

给主人留下些什么吧!~~