8

私はのようなコンボを持っています

        items: {  
            xtype: 'combo',
            id: 'combo',
            queryMode: 'local',                
            displayField: 'name',
            valueField: 'id',
            store: Ext.create('Ext.data.Store', {
                fields: ['id', 'name', 'mydata'],
                data: [
                  {'id': '1', 'name': 'John Smith', 'mydata': ["3", "4"]},
                  {'id': '2', 'name': 'Albert Einstein', 'mydata': ["1", "2"]}
                ]
            }),
            listeners: {
               select: function( combo, records, eOpts ) {
                    alert(records[0].get('mydata')); // records is undefined
               }
            }
        }

しかし、私が使用するとき

    var combo = Ext.getCmp('combo');
    //combo.select("1");
    combo.setValue("1");
    combo.fireEvent('select');

その後、alert(records[0].get('mydata')); // records is undefined失敗します。この問題を解決する方法ありがとう。
ここに私のコードがありますhttp://jsfiddle.net/LZ8XU/

4

2 に答える 2

4

change代わりにイベントを聞いてみませんか?

于 2013-12-12T11:31:48.707 に答える