user1702486
user1702486

Reputation: 107

How to search item with keyboard letter key in extjs combobox? Javascript

I have a combobox I can get all data I want but when i enter a letter, the data should be choosen in combobox forexample,my variables: ankara, aston, amasya, bolu, berlin, .... When i enter 'a' letter ankara should be selected. if i enter 'as' word aston should be selected how can i do it? thanks..

 new Ext.form.ComboBox({
    id : 'il3',
    fieldLabel: dil('B Merkez İli'),
    hiddenName : 'b_il_id_hid',
    name : 'b_il_id',
    store: ilStore,
    valueField:'id',
  queryMode: 'local',
    displayField:'isim',
    typeAhead: true,
    triggerAction: 'all',
    emptyText: dil('İl Seçiniz...'),
    selectOnFocus:true,
    anchor: '100%',
    listeners:{
        select:{
            fn:function(combo, value) {
                var modelCmp = Ext.getCmp('ilce3');
                modelCmp.setDisabled(false);
                modelCmp.store.removeAll();
                modelCmp.setValue('');
                modelCmp.store.reload({
                    params: {
                        id: combo.getValue()
                    }
                });

            }
        }
    },
    allowBlank:false
})



store:


 var ilStore = new Ext.data.JsonStore({
root: 'rows',
totalProperty: 'results',
idProperty: 'id',
remoteSort: true,
autoLoad : true,

fields: [
'id', 'isim'
],
baseParams:{
    'tip':'il'
},
listeners:{
    beforeload:function(dukan,nesne){
        var modelCmp = Ext.getCmp('id-faz-yon1');
        dukan.baseParams.faz = modelCmp.getValue();
    },

         keyup: function() {
           this.store.filter('isim', this.getRawValue(), true, false);


    }

},
proxy: new Ext.data.HttpProxy({
    url: 'phps/sabit_agac_arama.php?lang=dil(lang)',
    method : 'POST'
})

});

Upvotes: 1

Views: 1388

Answers (1)

bldoron
bldoron

Reputation: 1080

Add queryMode: 'local', to the config. See the example in the API

Upvotes: 1

Related Questions