zoukankan      html  css  js  c++  java
  • ExtJs--05--给window组件加入功能条以及子组件获取上级或下级组件的属性和方法

    Ext.onReady(function(){
    	
    /**
    1--
    给容器组件加入控制条 及 控制项
    控制条 不同的方向有多种  tbar   lbar  rbar  bbar  fbar   
    2--
    依据组件本身拿到上级组件的属性及方法调用
     */
    	var win = new Ext.window.Window({
    				id:"id001",//自己定义编号
    				title:"自己定义标题信息",//标题
    				400,//宽度  能够使用百分比 自适应浏览器大小
    				height:400,//高度
    				top:0,
    				left:0,
    				layout:"vbox",
    				renderTo:Ext.getBody(),
    				// tbar   lbar  rbar  bbar  fbar
    				tbar:[{
    					text:"第一个button",
    					handler:function(btn){
    //						Ext.Msg.alert("no1","1 info ");
    //						btn.up("window").hide();  //第一种获得上级组件  当然up是向上查找,  down是向下查找
    						alert(btn.up("window").title);
    					}
    				},{
    					text:"第二个button",
    					handler:function(btn){
    //						Ext.Msg.alert("no2","2 info ");
    						Ext.getCmp("id001").hide();   //另外一种获得上级组件
    					}
    				},{
    					text:"第三个button",
    					handler:function(btn){
    //						Ext.Msg.alert("no3","3 info ");
    						//ownerCt:得到当前对象所在的容器组件。 
    						btn.ownerCt.ownerCt.hide();   //第三种获得上级组件
    //						btn.up().up().hide();  //第四种获得上级组件
    					}
    				}]
    		
    	});
    	
    	win.show();
    	
    })
    


  • 相关阅读:
    84最佳买卖股票时机含冷冻期(309)
    83 不同路径 II(63)
    82同路径(62)
    模块与包
    名称空间与作用域
    函数的参数
    函数对象
    函数继续学习中
    python学习day3-上午
    第一个完成程序:通过文件实现注册登录
  • 原文地址:https://www.cnblogs.com/yangykaifa/p/6698582.html
Copyright © 2011-2022 走看看