1. #1
    Ext JS Premium Member
    Join Date
    Aug 2008
    Posts
    8
    Vote Rating
    0
    vraj is on a distinguished road

      0  

    Default combobox type ahead with 'any' match

    combobox type ahead with 'any' match


    I am new to ext-js and is it possible to have a type assist in combobox which filters the list with items that has the user typed in characters . For example in the "States" combobox if the user types in "Carolina" the list needs to populate "North Carolina" and "South Carolina". Any help is greately appreciated.

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    if you're using remote, yes, it's easy. local, you'll have to modify the way it filters the store.

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2008
    Posts
    8
    Vote Rating
    0
    vraj is on a distinguished road

      0  

    Default


    I am using local. I have no idea where to modify the filtering code.I tried to override the following
    Ext.override(Ext.form.ComboBox, {
    onTypeAhead : function(){
    }
    });
    but it is not helping.

  4. #4
    Ext JS Premium Member
    Join Date
    Aug 2008
    Posts
    8
    Vote Rating
    0
    vraj is on a distinguished road

      0  

    Default


    Overriddding the doQuery function to pass extra parameter to the filter funtion works.

    Ext.override(Ext.form.ComboBox, {
    doQuery : function(q, forceAll){
    if(q === undefined || q === null){
    q = '';
    }
    var qe = {
    query: q,
    forceAll: forceAll,
    combo: this,
    cancel:false
    };
    if(this.fireEvent('beforequery', qe)===false || qe.cancel){
    return false;
    }
    q = qe.query;
    forceAll = qe.forceAll;
    if(forceAll === true || (q.length >= this.minChars)){
    if(this.lastQuery !== q){
    this.lastQuery = q;
    if(this.mode == 'local'){
    this.selectedIndex = -1;
    if(forceAll){
    this.store.clearFilter();
    }else{
    this.store.filter(this.displayField, q, true);
    }
    this.onLoad();
    }else{
    this.store.baseParams[this.queryParam] = q;
    this.store.load({
    params: this.getParams(q)
    });
    this.expand();
    }
    }else{
    this.selectedIndex = -1;
    this.onLoad();
    }
    }
    }
    });

  5. #5
    Ext User skaue's Avatar
    Join Date
    Sep 2008
    Location
    Troms
    Posts
    191
    Vote Rating
    0
    skaue is on a distinguished road

      0  

    Exclamation


    This should definitely be an option on the combobox. Should not be necessary to override doQuery to achieve this.
    Webdeveloper from Norway

  6. #6
    Ext User
    Join Date
    Nov 2008
    Posts
    12
    Vote Rating
    0
    manduks is on a distinguished road

      0  

    Thumbs up


    hopefully the 3.0 release would have this option it would be more easy to use than overwrite the combo, maybe with a property like (anymatch:bolean), also thanks for the overwriting code it help me a lot but you need to set typeAhead: false or simply don´t put it so it works fine , thanks "vraj"

  7. #7
    Sencha User
    Join Date
    May 2010
    Posts
    14
    Vote Rating
    0
    neofraktal is on a distinguished road

      0  

    Default


    Hi, has been implemented it in ext 3.x?

    I couldn't find it.

  8. #8
    Sencha User
    Join Date
    Feb 2011
    Posts
    1
    Vote Rating
    0
    KenB is on a distinguished road

      0  

    Default


    +1, this ought to be built in.

    Quote Originally Posted by neofraktal View Post
    Hi, has been implemented it in ext 3.x?

    I couldn't find it.

  9. #9
    Sencha User
    Join Date
    Aug 2008
    Posts
    9
    Vote Rating
    0
    Geode is on a distinguished road

      0  

    Default


    Hi,

    I do have a question on this...

    I have a list of below values. when the user try to type 'th', it should show the suggested list as 'Vijith, Ajith'. how to do that...?

    Vijith
    Arun
    Ajith