我在 Extjs 中创建了一个组合框,其中显示了报告的名称,当用户选择任何报告时,应该在后端发布报告的 id。我无法获得报告的 ID。我正在使用商店在组合框中填充数据。
我在 Extjs 中创建了一个模型,例如
Ext.define('Report', {
extend: 'Ext.data.Model',
fields: [
{name: 'ReportId', type: 'int'},
{name: 'DisplayName', type: 'string'}
]
});
商店就像
var reportStore = Ext.create('Ext.data.Store', {
model: 'Report',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'reportlist.json'
});
像组合框
var comboReports = Ext.create('Ext.form.field.ComboBox', {
displayField: 'DisplayName',
valueField: 'ReportId',
fieldLabel: 'Report',
store: reportStore,
queryMode: 'local',
emptyText: 'Select a report',
selectOnFocus: true,
listeners: {
select: function(combo, selection) {
if (combo.getValue()) {
//showData(reportId); here i want the id of seleted report to passed.
}
}
}
});