写一个Ext页面,页面内容主要为表单,并且将不同类的表单元素分组
[code="java"]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
04.form
<br> Ext.onReady(function(){</p> <pre><code>// HtmlEditor需要这个 Ext.QuickTips.init(); var form = new Ext.form.FormPanel({ labelAlign: 'right', labelWidth: 50, width: 600, title: 'form', frame: true, items: [{ layout: 'column', items: [{ columnWidth:.7, xtype:'fieldset', checkboxToggle:true, title: '单纯输入', autoHeight:true, defaults: {width: 300}, defaultType: 'textfield', items: [{ fieldLabel: '文本', name: 'text' },{ xtype: 'numberfield', fieldLabel: '数字', name: 'number' },{ xtype:"combo", fieldLabel: '选择', name: 'combo', store: new Ext.data.SimpleStore({ fields: ['value', 'text'], data: [ ['value1', 'text1'], ['value2', 'text2'] ] }), displayField: 'text', valueField: 'value', mode: 'local', emptyText:'请选择' },{ xtype: 'datefield', fieldLabel: '日期', name: 'date' },{ xtype: 'timefield', fieldLabel: '时间', name: 'time' },{ xtype: 'textarea', fieldLabel: '多行', name: 'textarea' },{ xtype: 'hidden', name: 'hidden' }] },{ columnWidth:.3, layout:'form', items:[{ xtype:'fieldset', checkboxToggle:true, title: '多选', autoHeight:true, defaultType: 'checkbox', hideLabels: true, style: 'margin-left:10px;', bodyStyle: 'margin-left:20px;', items: [{ boxLabel: '首先要穿暖', name: 'check', value: '1', checked: true, width: 'auto' },{ boxLabel: '然后要吃饱', name: 'check', value: '2', checked: true, width: 'auto' },{ boxLabel: '房子遮风避雨', name: 'check', value: '3', width: 'auto' },{ boxLabel: '行路方便', name: 'check', value: '4', width: 'auto' }] },{ xtype:'fieldset', checkboxToggle:true, title: '单选', autoHeight:true, defaultType: 'radio', hideLabels: true, style: 'margin-left:10px;', bodyStyle: 'margin-left:20px;', items: [{ boxLabel: '渴望自由', name: 'rad', value: '1', checked: true, width: 'auto' },{ boxLabel: '祈求爱情', name: 'rad', value: '2', width: 'auto' }] }] }] },{ layout: 'form', labelAlign: 'top', items: [{ xtype: 'htmleditor', fieldLabel: '在线编辑器', id: 'editor', anchor: '98%' }] }], buttons: [{ text: '保存' },{ text: '读取' },{ text: '取消' }] }); form.render("form"); </code></pre> <p>});<br>
[/code]
[code="java"]
04.form
<br> Ext.onReady(function(){</p> <pre><code>Ext.QuickTips.init(); var form = new Ext.form.FormPanel({ labelAlign: 'right', labelWidth: 60, title: 'form', frame:true, width: 450, url: 'form.jsp', items: [{ layout:'column', items: [{ columnWidth:.5, layout: 'form', xtype: 'fieldset', title: '俩字', autoHeight: true, defaultType: 'textfield', items:[ {fieldLabel: '俩字'}, {fieldLabel: '俩字'} ] },{ columnWidth:.5, layout: 'form', xtype: 'fieldset', title: '三个字', autoHeight: true, style: 'margin-left: 20px;', defaultType: 'textfield', items:[ {fieldLabel: '三个字'}, {fieldLabel: '三个字'}, {fieldLabel: '三个字'}, {xtype: 'panel',html: '<center><img src="user_female.png" /></center>'} ] }] },{ xtype: 'fieldset', title: '四个汉字', autoHeight: true, items: [{ width: 345, height: 100, xtype: 'textarea', fieldLabel: '四个汉字' }] }], buttons: [{ text: '按钮', handler: function() { form.getForm().submit(); } }] }); form.render("form"); </code></pre> <p>});<br>
[/code]
这些你都可以去看EXTJS里面自带的example来自己尝试啊
里面有那个group分组的示例的
你可以利用FieldSet组件
参考
[url]http://www.extjs.com/deploy/dev/examples/form/dynamic.html[/url]
[url]http://www.extjs.com/deploy/dev/examples/form/check-radio.html[/url]