Ext js 下拉框下拉的同时输入模糊查询

 var joincmpcombo = new Ext.form.ComboBox({//设计师
                    id: ‘joincmp_name‘,
                    name: ‘joincmp_name‘,
                   hiddenName: ‘joincmp‘, //后台获取的是id的值
                    fieldLabel: ‘联盟商‘,
                    valueField: ‘joincmp_id‘, //ComboBox的值,如果提交表单,这个值是要传到后台的
                    displayField: ‘joincmp_name‘, //这个是下拉框显示的值
                    allowBlank: true, //是否允许为空
                    blankText: ‘请选择联盟商‘, //为空显示的值
                    triggerAction: ‘all‘, //显示所有下拉框的值
                    typeAhead:true,
                    store: joincmp,
                    anchor: ‘95%‘,
                    mode: ‘local‘  ,//必须用本地加载
                    editable:true,
                    queryParam:‘text‘,
                    listeners : {
                        ‘beforequery‘:function(e){
                            var combo = e.combo;   
                            if(!e.forceAll){   
                                var value = e.query; 
                                var regExp = new RegExp(".*" + value + ".*");  
                                combo.store.filterBy(function(record,id){   
                                    var text = record.get(combo.displayField);   
                                    return regExp.test(text);   
                                });//alert(0);
                                combo.expand();
                                return false;
                            }
                        }
                    }

                });

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。