EXT+formpanel+之+table+布局+并且显示+fieldlabel

 <script type="text/javascript">
    function getBodyWidth(){
        return document.body.clientWidth-15;
    }
   
    function func_submit_onclick(){
        alert('hello');
    }
    var _bodyWidth = getBodyWidth();
    var _columns = 3;
    var _perWidth = _bodyWidth/_columns;
   
    Ext.onReady(function(){
       
        Ext.QuickTips.init();
        var tableForm=new Ext.FormPanel({
            name:'tableForm',
            id:'tableForm',
            frame:true,
            layout:'table',
            style:'height:100%',
            layoutConfig: {columns:_columns},
            title:'TableForm',
            defaults:{layout:'form',labelAlign:'right',width:_perWidth}
        });
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'datefield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'datefield',fieldLabel:'to',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
        tableForm.add({colspan:1,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
       
        tableForm.addButton({text:'submit',handler:func_submit_onclick});
        tableForm.addButton({text:'cancel'});
       
        tableForm.render(Ext.getBody());
    });        
    </script>

 

原文:

<script type="text/javascript">

02    function getBodyWidth(){
03        return document.body.clientWidth-15;
04    }
05      
06    function func_submit_onclick(){
07        alert('hello');
08    }
09    var _bodyWidth = getBodyWidth();
10    //var _bodyWidth=900;
11    var _columns = 3 * 2;
12    var _perWidth = _bodyWidth/_columns;
13      
14    Ext.onReady(function(){
15          
16        Ext.QuickTips.init();
17        var tableForm=new Ext.FormPanel({
18            name:'tableForm',
19            id:'tableForm',
20            frame:true,
21            //width:_bodyWidth+30,
22            layout:'table'
23            style:'height:100%',
24            //bodyStyle: 'padding:8px 0 0 0;' ,    //上-右-下-左
25            layoutConfig: {columns:_columns},
26            title:'TableForm',
27            defaults:{border:false,bodyStyle: 'padding:8px 0 0 0;',
28                      layout:'form',frame:false,labelAlign:'right',labelWidth:75,width:_perWidth*2,height:30
29            
30        });
31        tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
32        tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
33        tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
34  
35        tableForm.add({colspan:1,width:_perWidth,items:{xtype:'datefield',fieldLabel:'First Name',anchor:'100%'}});
36        tableForm.add({colspan:1,width:_perWidth,labelAlign:'center',items:{xtype:'datefield',fieldLabel:'to',anchor:'100%'}});
37        tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
38        tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
39  
40        tableForm.add({colspan:2,items:{xtype:'hidden',fieldLabel:'First Name',anchor:'100%'}}); //隐藏列,用于空白列布局
41        tableForm.add({colspan:4,width:_perWidth*4,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}});
42          
43        tableForm.addButton({text:'submit',handler:func_submit_onclick});
44        tableForm.addButton({text:'cancel'});
45          
46        tableForm.render(Ext.getBody());
47  
48    });         
49    </script>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值