ExtJs2.0学习系列(3)--区域布局之column布局

Column列布局由Ext.layout.ColumnLayout类定义,名称为column。列布局把整个容器组件看成一列,然后往里面放入子元素的时候,可以通过在子元素中指定使用columnWidth或width来指定子元素所占的列宽度。columnWidth表示使用百分比的形式指定列宽度,而width则是使用绝对象素的方式指定列宽度,在实际应用中可以混合使用两种方式。

 

代码:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ExtJs2.0学习系列(2)--区域布局之column布局 </title>
<link type="text/css" href="Ext/resources/css/ext-all.css" rel="stylesheet" />
<script type="text/javascript" src="Ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="Ext/ext-all.js"></script>
<script type="text/javascript">
  Ext.onReady(function(){
     var panel=new Ext.Panel({
    title:"test",
    x:100,
    y:100,
    renderTo:"pnl",
    floating:true,
    frame:false,
    width:400,
    height:300,
    draggable:{
        insertProxy:false,
     onDrag:function(e){
        var ele=this.proxy.getEl();
     this.x=ele.getLeft(true);
     this.y=ele.getTop(true);
     var sd=this.panel.getEl().shadow;
     if(sd)
     {
       sd.realign(this.x,this.y,ele.getWidth(),ele.getHeight());
     }
     },
     endDrag:function(e){
       this.panel.setPosition(this.x,this.y);
     }
    },
    layout:"column",
    items:[{
       columnWidth:.5,
    height:100,
    html:"fadfasd",
    frame:false,
    collapsible:true,
    title:"panel1"
   
    },{
       columnWidth:.5,
    title:"panel2"
    }]
 });
  });
</script>
</head>

<body>
<div id="pnl"></div>
</body>
</html>

下图为该示例实现的效果:

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值