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.
}
}
}
});