Extjs布局

newinfo.js

Ext.onReady(function() {
	var list = [['语文', '语文'], ['数学', '数学'], ['英语', '英语']];

	var store = new Ext.data.SimpleStore({
				fields : ['value', 'text'],
				data : list
			});

	var combo = new Ext.form.ComboBox({
				fieldLabel : '科目',
				name : 'combo',
				id:'subject',
				store : store,
				displayField : 'text',
				valueField : 'value',
				mode : 'local',
				allowBlank : false
			});

	var panel = new Ext.Panel({
				renderTo : Ext.getBody(),
				width : 800,
				height : 110,
				layout : 'border',
				items : [{
							region : 'west',
							width : 600,
							xtype : 'fieldset',
							title : '信息',
							items : [{
								layout:'form',
								border:false,
								items:[{
									layout : 'column',
									items : [{
													columnWidth:0.35,
													xtype : 'form',
													border : false,
													labelWidth:30,
													items : combo
												}, {
													columnWidth:0.65,
														xtype : 'radiogroup',
														id:'sex',
														items : [{
																fieldLabel : '性别',											
																boxLabel : '男',
																name : 'radio',																
																value : '1',
																checked : true
															}, {
																boxLabel : '女',
																inputValue:'女',
																name : 'radio',
																value : '2'
															}]													
												}]
								},{
										// 第二行
										layout : 'column',
										items : [{
													columnWidth : 0.75,
													layout : 'form',
													border : false,
													labelWidth:40,
													items : [{
																xtype : 'textfield',
																fieldLabel : '分数',	
																name : 'score',
																id:'score',
																emptyText : '输入分数'
													}]
												}, {
													columnWidth : 0.25,
													layout : 'form',
													border : false,
													items:[{
														xtype : 'button',
														text : '打开'
													}]												
												}]
								}]
						}]
				}, {
							region : 'center',
							width : 200,
							layout : 'column',
							items : [{
								columnWidth : 0.33,
								items : [{
											xtype : 'panel',
											border : false,
											height : 110
										}]
							}, {
								columnWidth : 0.33,								
									layout : 'form',
									border:false,
									items:[{
										xtype : 'button',
										text : '确定',
										width : 100,
										height : 20,
										handler: function(){
												var location=Ext.getCmp("score").getValue();
												var subject=Ext.getCmp("subject").getValue();
												var choices=Ext.getCmp("sex").items['items'];
												for(var i=0;i<choices.length;i++)
												{
													if(choices[i].checked)
													{
														var sex=choices[i].boxLabel;
													}
												}
												alert(location+"\t"+subject+"\t"+sex);
										}
								}, {
									xtype : 'panel',
									border : false,
									height : 60
								}, {
									xtype : 'form',
									border:false,
									items : [{
										xtype:'button',
										text : '取消',
										width : 100,
										height : 20
									}]
							}]
						}, {
								columnWidth : 0.33,
								items : [{
											xtype: 'panel',
											border : false,
											height : 110											
										}]	
						}]
				}]
	});				
});

html:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
	<title>My Extjs Guide</title>
	<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
    <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" src="./js/newinfo.js"></script>
</head>
<body>
		
</body>
</html>

工程架构视图:


最终效果图:


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值