【发布时间】:2016-06-04 09:17:56
【问题描述】:
我正在使用 ExtJS 从数据库创建一个 formPanel dynamyc(从服务器到对象 extjs 的字符串结果)
Ext.Ajax.request({
async : false,
method : 'POST',
url : '/Devt/GetFormItemCustomization',
params : {
TableName : 'tabeltest',
col : 1
},
success : function (response) {
var results = Ext.decode(response.responseText);
console.log(results );
var form = Ext.create('Ext.form.Panel', {
width : 300,
bodyPadding : 10,
renderTo : 'formCustDiv',
name : "test",
items : [results]
});
}
})
来自服务器的响应:
{
fieldLabel:'Employee Id',
xtype:'textfield',
allowBlank:false,
},
{
fieldLabel:'Nick Name',
xtype:'textfield',
allowBlank: false,
}
但这只会从最后一个数据创建一个对象。 对象
{
fieldLabel: "Nick Name",
xtype: "textfield",
allowBlank: false
}
我希望服务器解码的响应变成两个对象:
对象 {fieldLabel: "Employee Id", xtype: "textfield", allowBlank: false}
对象 {fieldLabel: "Nick Name", xtype: "textfield", allowBlank: false}
有什么建议吗?
【问题讨论】:
标签: javascript json extjs decode extjs6