首先第一个问题是:window-->tabpanel-->formpanel,因为tabpanel下有n个表单,希望是提交时所有都能够提交。
还没有解决。
第二个问题是:如果第一个问题没解决,希望是可以把所有的值拼写成json格式,然后提交。
这该怎么写。
Ext.apply( Object obj, Object config, Object defaults )
复制config对象的所有属性到obj
Ext.applyIf( Object obj, Object config );
复制所有config的属性至obj,如果obj已有该属性,则不复制
07.window
<br> Ext.onReady(function(){</p> <pre><code>var form1 = new Ext.form.FormPanel({ defaultType: 'textfield', labelAlign: 'right', title: 'form', labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: '文本框', name: 'text' }] }); var form2 = new Ext.form.FormPanel({ defaultType: 'textfield', labelAlign: 'right', title: 'form', labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: '文本框2', name: 'text2' }] }); </code></pre> <p>[color=red] //obj对象的所有属性拷贝到src对象上<br> function allOtherJsObject(src,obj) {<br><br> for(var p in obj){<br><br> src[p] = obj[p];<br><br> }<br><br> } [/color] </p> <pre><code>var win = new Ext.Window({ el:'window-win', layout:'form', width:500, height:300, closeAction:'hide', items: [form1,form2], buttons: [{ text:'按钮',handler:function(){ [color=red]var f1 = form1.form.getValues(); var f2 = form2.form.getValues(); allOtherJsObject(f1,f2); alert(Ext.encode(f1) );[/color] } }] }); win.show(); </code></pre> <p>});<br>
函数名allOtherJsObject 改成addOtherJsObject 更好听点 呵呵
或许有更好的写法 呵呵
07.window
<br> Ext.onReady(function(){</p> <pre><code>var form1 = new Ext.form.FormPanel({ defaultType: 'textfield', labelAlign: 'right', title: 'form', labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: '文本框', name: 'text' }] }); var form2 = new Ext.form.FormPanel({ defaultType: 'textfield', labelAlign: 'right', title: 'form', labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: '文本框2', name: 'text2' }] }); var win = new Ext.Window({ el:'window-win', layout:'form', width:500, height:300, closeAction:'hide', items: [form1,form2], buttons: [{ text:'按钮',handler:function(){ [color=darkred]var f1 = form1.form.getValues(); var f2 = form2.form.getValues(); Ext.apply(f1,f2);//复制f2对象的所有属性到f1 alert(Ext.encode(f1));[/color] } }] }); win.show(); </code></pre> <p>});<br>