extjs formpanel提交如何拼写json格式?

首先第一个问题是: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: &#39;textfield&#39;, labelAlign: &#39;right&#39;, title: &#39;form&#39;, labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: &#39;文本框&#39;, name: &#39;text&#39; }] }); var form2 = new Ext.form.FormPanel({ defaultType: &#39;textfield&#39;, labelAlign: &#39;right&#39;, title: &#39;form&#39;, labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: &#39;文本框2&#39;, name: &#39;text2&#39; }] }); </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:&#39;window-win&#39;, layout:&#39;form&#39;, width:500, height:300, closeAction:&#39;hide&#39;, items: [form1,form2], buttons: [{ text:&#39;按钮&#39;,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: &#39;textfield&#39;, labelAlign: &#39;right&#39;, title: &#39;form&#39;, labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: &#39;文本框&#39;, name: &#39;text&#39; }] }); var form2 = new Ext.form.FormPanel({ defaultType: &#39;textfield&#39;, labelAlign: &#39;right&#39;, title: &#39;form&#39;, labelWidth: 50, frame:true, width: 520, collapsible :true, items: [{ fieldLabel: &#39;文本框2&#39;, name: &#39;text2&#39; }] }); var win = new Ext.Window({ el:&#39;window-win&#39;, layout:&#39;form&#39;, width:500, height:300, closeAction:&#39;hide&#39;, items: [form1,form2], buttons: [{ text:&#39;按钮&#39;,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>