我已使用以下代码将数据从我的商店加载到 ExtJs 中的表单,但我无法将数据检索到我的文本字段。
Ext.onReady(function() {
var formPanel = Ext.create('Ext.form.Panel', {
title: 'Form Panel',
width: 350,
height: 200,
style: 'margin: 50px',
renderTo: 'musicianProfile', // the name of the div in my JSP
reader: new Ext.data.JsonReader({
type: 'json',
root: 'data',
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}
]
}),
items: [{
xtype: 'container',
layout: 'hbox',
items: [{
fieldLabel: 'First Name',
xtype: 'textfield',
name: 'firstName',
readOnly: true,
flex: 1,
}, {
fieldLabel: 'Last Name',
xtype: 'textfield',
name: 'lastName',
readOnly: true,
flex: 1,
}]
}]
});
formPanel.getForm().load({
method:'GET',
url:'ajax/viewMusicianMembers.htm' //URL that produces a JSON result
});
});
我从浏览器收到的值是:
{
"success":true,"total":1,"message":null,
"data":[{"firstName":"System","lastName":"Administrator"}],
"errors":null
}
谁能帮我找出错误在哪里,以及如何纠正它?