1

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.

                }
            }
        }
    });
4

1 に答える 1

7

combo.getValue()選択したアイテムのreportIdを 実際に返します。showData(combo.getValue());必要なものです。

于 2012-08-31T07:49:57.313 に答える