我通过后台生成json来动态生成extjs的form表单,json传到了页面,可是显示的表单只会是最后一个,为什么?
后台代码:
String result="{layout : 'column',items : [{columnWidth : .25,layout : 'form',items : [{fieldLabel : '中 标 号 码',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.bidNum'}]}, {columnWidth : .25,layout : 'form',items : [{fieldLabel : '关 系 号 码',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.relationNum'}]}, {columnWidth : .25,layout : 'form',items : [{fieldLabel : '屏 蔽 号 码',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.shieldNum'}]}]},{layout : 'column',items : [{columnWidth : .25,layout : 'form',items : [{fieldLabel : '中 标',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.bidNum'}]}, {columnWidth : .25,layout : 'form',items : [{fieldLabel : '关 系',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.relationNum'}]}, {columnWidth : .25,layout : 'form',items : [{fieldLabel : '屏 蔽',anchor : '95%',xtype : 'textfield',name : 'messageComplexQuery.shieldNum'}]}]}";
页面代码:
function showComplexQueryMain() {
check();
// 构造菜单
Ext.Ajax.request({
url : 'showPageAction',
params : {
'menuId' : getUrlValue()
},
success : function(action) { var obj = Ext.util.JSON.decode(action.responseText);
if (obj.success) {
myform = obj.result;
alert(myform);

var formPanel = new Ext.FormPanel({
labelWidth : 60,
anchor : '100%',
renderTo : 'copmlexQuery',
frame : true,
method : 'post',
/*
 * items:[{ layout : 'column', bodyStyle : 'padding:30px
 * 40px 0', items:[{ layout : 'column', columnWidth : .7,
 * items:[{ columnWidth : .5, layout : 'form', border :
 * false, items:[eval('('+myform+')')] }] }] }]
 */
items : [eval('('+myform+')'), {
layout : 'column',
items : [{
columnWidth : .25,
layout : 'form',
items : [{
xtype : 'hidden',

anchor : '95%' }] }, {
columnWidth : .05, layout : 'form',
items : [{
xtype : 'tbbutton',
anchor : '95%',
iconCls : 'addApplyCss',
text : '加入申请' }] }, {
columnWidth : .05,
layout : 'form',
items : [{
xtype : 'tbbutton',
anchor : '95%',
iconCls : 'resetCss',
text : ' 重    置 ',
handler : function() {
formPanel.form.reset();
} }]
}]
}] });
}
},
failure : function(action) {
alert(action.responseText);
Ext.Msg.alert("友情提示", "加载失败!`````");
}
});}我 将resul的值放到items中就可以,可是从后台传,只会显示一条