Extjs Sencha ComboBox-存储绑定有问题
这是我的组合框Extjs Sencha ComboBox-存储绑定有问题,extjs,Extjs,这是我的组合框 xtype: 'combo', emptyText: 'No Data Found', labelStyle: 'margin-bottom:5px;', fieldLabel: 'Categories', labelAlign: 'top', id: 'cmbCategories', store: ['Age','Sex','Occu
xtype: 'combo',
emptyText: 'No Data Found',
labelStyle: 'margin-bottom:5px;',
fieldLabel: 'Categories',
labelAlign: 'top',
id: 'cmbCategories',
store: ['Age','Sex','Occupation'],
editable: false,
queryMode: 'local',
matchFieldWidth: false,
listConfig: {
width: 250
}
问题是我总是得到空文本,即“找不到数据”。
我不知道为什么我的数据没有绑定。var states=Ext.create('Ext.data.Store'{
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}
]
});
商店:美国,
displayField:'名称',
valueField:'abbr',您希望得到什么?您配置的组合工作正常。如果您希望在其文本字段部分中有一个值,则必须从下拉列表中选择一个项目。如果您希望组合最初有一个值,只需将其添加到配置中,例如
值:'Age'
您的存储错误:存储:[“年龄”、“性别”、“职业”],
这应该是:
store: Ext.create('Ext.data.Store', {
fields: ['name', 'value'],
data : [
{"name":"Age", "value": 0 },
{"name":"Sex", "value": 1 },
{"name":"Location", "value": 2 }
]
}),
displayField: 'name',
valueField: 'value',
editable: false,
....