我在Extjs中创建了一个组合框,我在其中显示报告的名称,当用户选择任何报告时,应该发布报告的后端ID.我无法得到报告的身份.我正在使用商店来填充组合框中的数据.
我在Extjs中创建了一个模型
Ext.define('Report', {
extend: 'Ext.data.Model',
fields: [
{name: 'ReportId', type: 'int'},
{name: 'DisplayName', type: 'string'}
]
});
Run Code Online (Sandbox Code Playgroud)
商店就像
var reportStore = Ext.create('Ext.data.Store', {
model: 'Report',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'reportlist.json'
});
Run Code Online (Sandbox Code Playgroud)
comboBox就好
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.
}
}
}
});
Run Code Online (Sandbox Code Playgroud)