问题描述
Ext.BLANK_IMAGE_URL='../../ExtJS/resources/images/default/s.gif';Ext.QuickTips.init();Ext.override(Ext.form.ComboBox,{onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){if(!this.isExpanded()){//this.onTriggerClick();//this.selectText(this.getRawValue().length,this//.getRawValue().length);}this.store.removeAll();if(this.id=="customer_name"){this.store.reload({params:{customer_name:this.getRawValue()}})}elseif(this.id=="customer_code"){this.store.reload({params:{customer_code:this.getRawValue()}})}elseif(this.id=="product_name"){if(Ext.get("customer.customer_id").dom.value!=""){this.store.reload({params:{customerId:Ext.get("customer.customer_id").dom.value,productName:this.getRawValue()}})}}elseif(this.id=="product_number"){if(Ext.get("customer.customer_id").dom.value!=""){this.store.reload({params:{customerId:Ext.get("customer.customer_id").dom.value,productNumber:this.getRawValue()}})}}varindex=this.store.find(this.displayField,this.getRawValue());if(index!==-1){//this.select(this.store.getCount()-1);//this.select(index,true);}else{//this.select(0,true);//this.setValue(this.getRawValue());}}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);this.keyNav=newExt.KeyNav(this.el,{"up":function(e){this.inKeyMode=true;this.selectPrev();},"down":function(e){if(!this.isExpanded()){this.onTriggerClick();}else{this.inKeyMode=true;this.selectNext();}},"enter":function(e){this.onViewClick();this.delayedCheck=true;this.unsetDelayCheck.defer(10,this);},"esc":function(e){this.collapse();},"tab":function(e){this.collapse();//this.onViewClick(false);returntrue;},scope:this,doRelay:function(foo,bar,hname){if(hname=='down'||this.scope.isExpanded()){returnExt.KeyNav.prototype.doRelay.apply(this,arguments);}returntrue;},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=='local'?10:250);this.dqTask=newExt.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=newExt.util.DelayedTask(this.onTypeAhead,this);}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);}if(this.forceSelection){this.on('blur',this.doForce,this);}}});
解决方案
解决方案二:
看了看,觉得这个写的好复杂啊,跟EXT的源代码有的一拼,能看懂一小部分,这个是对下拉框的一系列设置操作,包括收缩和展开的时候。
解决方案三:
说实在的,没看懂
解决方案四:
重写了extjs的combobox当在不同地方new这个combobox的时候,根据自身的id不同加载不同的数据,然后定义了一些键盘事件来快速操作这个combobox
解决方案五:
引用3楼dataminer_2007的回复:
重写了extjs的combobox当在不同地方new这个combobox的时候,根据自身的id不同加载不同的数据,然后定义了一些键盘事件来快速操作这个combobox
高手啊。学习。
解决方案六:
该回复于2011-04-01 14:35:12被版主删除
解决方案七:
就是从写了Ext.form.ComboBox中一些事件的处理方法
解决方案八:
基本上弄懂了大概,这是我同事写的,牛的很啊