ExtJS Combo 过滤

Js代码
var combo = new Ext.form.ComboBox({  
        id:'somecombo',  
        store: combostore,  
        displayField:'state',  
        typeAhead: true,  
        width: 180,  
        mode: 'local',  
        //enableKeyEvents: true,  
        forceSelection: true,  
        triggerAction: 'all',  
        emptyText:'Select a state...',  
        selectOnFocus:true,  
        renderTo: document.body  
    });  
 
    combo.on('beforequery',function(e){  
        var combo = e.combo;  
        if(!e.forceAll){  
            var value = e.query;  
            combo.store.filterBy(function(record,id){  
                var text = record.get(combo.displayField);  
                        //用自己的过滤规则,如写正则式  
                return (text.indexOf(value)!=-1);  
            });  
            combo.expand();  
            return false;  
        }  
    }); 

你可能感兴趣的:(ext)