1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    1
    Vote Rating
    0
    betoranaldi is on a distinguished road

      0  

    Default Unanswered: ComboBox and partial string match.

    Unanswered: ComboBox and partial string match.


    Please forgive me as I am new here and having trouble wrapping my head around all of this. I know this topic has been posted before but it appears to only apply to older version as when I try to implement the suggestions I get undefined errors.

    I am looking to create a simple ComboBox that allows me to list/search products. Using the transform feature of an existing dropdown, I have the following code:

    Code:
     Ext.onReady(function() {
     var transformed = Ext.create('Ext.form.field.ComboBox', {
                        typeAhead: true,
                        transform: 'productSelector',
                        autoSelect: false,
                        width: 764,
                        listWidth: 714,
                        minChars: '3',
                        forceSelection: true,
                        anyMatch: true,
                        emptyText: 'Select A Product',
                        triggerAction: 'all',
                        editable: true,
                        autoSelect: false,
                        listEmptyText: 'No products found',
                        allowBlank: true,
                        listeners: {
                            'blur': function () {
                                if (this.store.getCount() == 0 || (!this.isExpanded())) {
                                    if (this.getValue() == '' || this.findMatch('text', this.getRawValue()) == false) {
                                        this.setValue('');
                                        this.blur();
                                    }
                                }
                            },
                            'expand': function(self) { self.clearValue(); },
                            scope:this
                        }
                    });
                });
    This seems to work fairly well I just can't figure out how to get partial string search working.

    This seems like the most common solution I have found but I just can't get it to work. Perhaps this is becuase I am using the transform method.

    Code:
    doQuery : function(q, forceAll){        q = Ext.isEmpty(q) ? '' : 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);
                        }
                        this.onLoad();
                    }else{
                        this.store.baseParams[this.queryParam] = q;
                        this.store.load({
                            params: this.getParams(q)
                        });
                        this.expand();
                    }
                }else{
                    this.selectedIndex = -1;
                    this.onLoad();
                }
            }
        },
    Any suggestions or pointers would greatly be appreciated.

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,021
    Answers
    385
    Vote Rating
    183
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Can you post an example of the HTML you're using for the transform?
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

Thread Participants: 1