开发者

EXTJS combobox default value after form layout

My combobox's data is loaded after the form layout.

var villeStore = new Ext.data.ArrayStore({
            fields: [{name:'idVille'}
                    ,{name: 'ville'}]
        });
var villeInput = new Ext.form.ComboBox({
        fieldLabel: 'Ville',
        store: villeStore,
        valueField:'idVille',
        displayField:'ville',
        typeAhead: true,
        mode: 'local',
        triggerAction: 'all',
        emptyText:'Ville',
        width:100,
        id:'villeInput'
    });

The problem is that I n开发者_Python百科eed to display the last of the store, but even have the valueField, because when I click on a button, this is what I send to server

I did this, but it don't work, it show the last store value, but don't have the valueField

villeInput.store.on('load',function(store) {
        villeInput.setValue(store.getAt(villeInput.store.getCount()-1).get('ville'));
    });


The problem is that you need to set the value of the combo using the valueField (which is idVille) instead of the displayField:

villeInput.store.on('load',function(store) {
    villeInput.setValue(store.getAt(villeInput.store.getCount()-1).get('idVille'));
});


Try this:

    villeInput.store.on("load", function(store) {
                villeInput.setValue(ActualidVille, false);
  }, this);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜