Filter options on ExtJS ComboBox with typeAhead

10,303

I've just solved it, I had to add the properties queryMode set to local and lastQuery set to empty string.

Ending up having this code:

var tboxReportaNombre = Ext.create('Ext.form.field.ComboBox', {
    margin: '5 0 0 10',
    store: reportersNamesStore,
    displayField: 'vcReportaNombre',
    valueField: 'vcReportaNombre',
    hideTrigger: true,
    typeAhead: true,
    typeAheadDelay: 100,
    minChars: 2,
    queryMode: 'local',
    lastQuery: ''
});

I think Sencha should implement a Typeahead property and methods to its textboxfield.

Share:
10,303
Multitut
Author by

Multitut

merge delete

Updated on June 05, 2022

Comments

  • Multitut
    Multitut almost 2 years

    I basically want to make a combo box look like a textBox with autocomplete/typeahead capabilities.

    I have achieved almost everything but filtering the results on type ahead using the following code:

    var tboxReportaNombre = Ext.create('Ext.form.field.ComboBox', {
        margin: '5 0 0 10',
        store: reportersNamesStore,
        displayField: 'vcReportaNombre',
        valueField: 'vcReportaNombre',
        hideTrigger: true,
        typeAhead: true,
        typeAheadDelay: 100,
        minChars: 2,
        mode: 'local'
    });
    

    And this is the store I am using:

    var reportersNamesStore = Ext.create('Ext.data.Store', {
        fields: ['vcReportaNombre'],
        proxy: {
            type: 'ajax',
            url: '/SIMAC/Incidencia/GetReportersNames',
        }
    });
    

    It is working just fine, but when I start typing, I would like the dropdown list to be filtered to match my query. Right now it doesn't (as shown in the image below).

    Dropdown not matching my query

    Any help would be really appreciated. Thanks!

  • Yaser Har
    Yaser Har over 7 years
    I'm trying to fix the same problem but my queryMode is not local. lastQuery = '' alone doesn't seem to help. I don't get why queryMode would have affected it.