<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>layout_form.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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">
Ext.onReady(function(){
var f = new Ext.form.FormPanel(
{
title:"灵活布局的表单",//表单标题
labelAlign:"right",//标签布局
labelWidth:65,//标签宽度
layout:"form",//表单布局,form(由上至下)
width:700,//表单宽度
autoHeight:true,//自动计算高度
frame:true,//显示效果更好
url:"",//提交到的url
method:"post",//提交方式
items:[ //表单组件
{ // 第一行
layout:"column",//布局,column(从左到右),结合form与column可以制作任意布局的表单。
items:[
{
columnWidth:0.33,//占一行的百分比
layout:"form",//布局
items:[//具体的表单组件。
{
xtype:"textfield",
name:"family",
fieldLabel:"姓",
width:165
}
]
},
{
columnWidth:0.33,
layout:"form",
items:[
{
xtype:"textfield",
name:"name",
fieldLabel:"名",
width:165
}
]
},
{
columnWidth:0.33,
layout:"form",
items:[
{
xtype:"textfield",
name:"enName",
fieldLabel:"英文名",
width:165
}
]
}
]
},
{ // 第2行
layout:"column",
items:[
{
columnWidth:0.5,
layout:"form",
items:[
{
xtype:"textfield",
name:"family",
fieldLabel:"座右铭1",
width:250
}
]
},
{
columnWidth:0.5,
layout:"form",
items:[
{
xtype:"textfield",
name:"name",
fieldLabel:"座右铭2",
width:250
}
]
}
]
},
{ // 行3
layout:"form",
items:[
{
xtype:"textfield",
name:"up",
width:500,
fieldLabel:"奖励"
}
]
},
{ // 行4
layout:"form",
items:[
{
xtype:"textfield",
name:"lown",
width:500,
fieldLabel:"处罚"
}
]
},
{ // 第5行
layout:"column",
items:[
{
columnWidth:0.25,
layout:"form",
items:[
{
xtype:"textfield",
name:"moive",
fieldLabel:"最爱电影",
width:125
}
]
},
{
columnWidth:0.25,
layout:"form",
items:[
{
xtype:"textfield",
name:"music",
fieldLabel:"最爱音乐",
width:125
}
]
},
{
columnWidth:0.25,
layout:"form",
items:[
{
xtype:"textfield",
name:"singer",
fieldLabel:"最爱歌手",
width:125
}
]
},
{
columnWidth:0.25,
layout:"form",
items:[
{
xtype:"textfield",
name:"sport",
fieldLabel:"最爱运动",
width:125
}
]
}
]
},
{ // 行6
layout:"form",
items:[
{
xtype:"htmleditor",
name:"pragrpha",
fieldLabel:"文章",
width:500
}
]
}
],
buttonAlign:"center",//按钮布局。
buttons:[
{
text:"确定",
icon:"../ext/resources/images/default/dd/drop-yes.gif",
cls:"x-btn-text-icon"
},{
text:"取消",
icon:"../ext/resources/images/default/dd/drop-no.gif",
cls:"x-btn-text-icon"
}
],
renderTo:"f"//绑定到某个元素上。
}
);
});
</script>
</head>
<body >
<div align="center" id="f"></div>
</body>
</html>
ext--form layout
最新推荐文章于 2023-12-11 09:48:59 发布