我是 ExtJs 4 的新手。我正在使用 Json 填充组合框,如下所示,
JSON:
{
"Patient": [
{
"id": 1,
"emergencyPhone": "1234567890",
"primaryInsuranceId": {
"id": 1
},
"secondaryInsuranceId": {
"id": 2
},
"personalInfo": {
"id": 2,
"firstName": "James",
"lastName": "Anderson",
"address": {
"state": {
"id": "2",
"stateName": "Alaska",
"code": "AK"
},
"zipcode": 12345,
"country": "USA",
"telephone": "1234567890",
"alternatePhone": "1234567890",
"faxNumber": "1234567890",
"email": "james@gmail.com"
},
"gender": "Male",
"dob": "2012-04-02",
"ssn": 123456789,
"race": "race"
},
"clearinghouseId": {
"id": 2,
"name": "ALPHA Clearing House"
},
"provider": []
}
]
}
代码:
Ext.define('patientList', {
extend: 'Ext.data.Model',
fields: ['id', 'personalInfo']
});
var patient = Ext.create('Ext.data.Store', {
model: 'patientList',
autoLoad: true,
proxy: {
type: 'ajax',
url: url + '/lochweb/loch/patient/getAll',
reader: {
type: 'json',
root: 'Patient'
}
}
});
组合框
{
xtype: 'combo',
fieldLabel: 'Patient',
name: "patientId",
id: "patientId",
queryMode: 'local',
store: patient,
displayField: 'personalInfo.firstName',
valueField: 'id',
emptyText: "Select",
editable: false,
allowBlank: false
}
当我单击组合框时,它显示名字,但选择后,它没有显示在下拉列表中。任何帮助
谢谢