From 1970029ddb00615756ed20320a4b835002a9a6e4 Mon Sep 17 00:00:00 2001 From: edward Date: Wed, 25 Apr 2018 16:37:42 +0800 Subject: [PATCH] Roo/bootstrap/ComboBox.js roojs-bootstrap.js roojs-bootstrap-debug.js --- Roo/bootstrap/ComboBox.js | 3 +++ roojs-bootstrap-debug.js | 5 ++++- roojs-bootstrap.js | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Roo/bootstrap/ComboBox.js b/Roo/bootstrap/ComboBox.js index 8b4ee82d74..6c46a1fb4c 100644 --- a/Roo/bootstrap/ComboBox.js +++ b/Roo/bootstrap/ComboBox.js @@ -1647,6 +1647,9 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.fireEvent('beforequery', qe)===false || qe.cancel){ return false; } + + Roo.log(qe); + q = qe.query; forceAll = qe.forceAll; diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 0be573d51f..417e7c1299 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -14053,6 +14053,9 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.fireEvent('beforequery', qe)===false || qe.cancel){ return false; } + + Roo.log(qe); + q = qe.query; forceAll = qe.forceAll; @@ -40211,7 +40214,7 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, { return; } - this.doQuery(this.getRawValue()); + this.doQuery(this.getCurrency()); }, getCurrency : function() diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 3fa230ddb8..286a78bb7e 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -559,7 +559,7 @@ if(r){this.select(this.store.indexOf(r),A);return true;}}return false;},select:f if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1); }}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return !this.list||!this.list.isVisible();},initQuery:function(){var v=this.getRawValue();if(this.tickable&&this.editable){v=this.tickableInputEl().getValue(); }this.doQuery(v);},doForce:function(){if(this.inputEl().dom.value.length>0){this.inputEl().dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;}},doQuery:function(q,A){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:A,combo:this,cancel:false} -;if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){this.hasQuery=true;if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1; +;if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}Roo.log(qe);q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){this.hasQuery=true;if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1; if(A){this.store.clearFilter();}else{if(this.specialFilter){this.fireEvent('specialfilter',this);this.onLoad();return;}this.store.filter(this.displayField,q);}this.store.fireEvent("datachanged",this.store);this.onLoad();Roo.log('onload???');}else{this.store.baseParams[this.queryParam]=q; var B={params:this.getParams(q)};if(this.loadNext){B.add=true;B.params.start=this.page*this.pageSize;}this.store.load(B);}}else{this.selectedIndex=-1;this.onLoad();}}this.loadNext=false;},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize; }return p;},collapse:function(){if(!this.isExpanded()){return;}this.list.hide();this.hasFocus=false;if(this.tickable){this.okBtn.hide();this.cancelBtn.hide();this.trigger.show();if(this.editable){this.tickableInputEl().dom.value='';this.tickableInputEl().blur(); @@ -1651,7 +1651,7 @@ this.inputEl().on("blur",this.onBlur,this);this.inputEl().relayEvent('keyup',thi this.inputEl().on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.inputEl().on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.inputEl().on("keypress",this.filterKeys,this); }else{this.inputEl().relayEvent('keypress',this);}var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator;}if(this.allowNegative){A+="-";}this.stripCharsRe=new RegExp('[^'+A+']','gi');var B=function(e){var k=e.getKey();var c=e.getCharCode();if((String.fromCharCode(c)=='.'||String.fromCharCode(c)=='-')&&A.indexOf(String.fromCharCode(c))===-1){e.stopEvent(); return;}if(!Roo.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE)){return;}if(A.indexOf(String.fromCharCode(c))===-1){e.stopEvent();}};this.inputEl().on("keypress",B,this);},onTriggerClick:function(e){if(this.disabled){return;}this.page=0;this.loadNext=false; -if(this.isExpanded()){this.collapse();return;}this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);return;}this.doQuery(this.getRawValue());},getCurrency:function(){var v=this.currencyEl().getValue();return v;},restrictHeight:function(){this.list.alignTo(this.currencyEl(),this.listAlign); +if(this.isExpanded()){this.collapse();return;}this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);return;}this.doQuery(this.getCurrency());},getCurrency:function(){var v=this.currencyEl().getValue();return v;},restrictHeight:function(){this.list.alignTo(this.currencyEl(),this.listAlign); this.list.alignTo(this.currencyEl(),this.listAlign);},onViewClick:function(A,B,el,e){var C=this.view.getSelectedIndexes()[0];var r=this.store.getAt(C);if(r){this.onSelect(r,C);}},onSelect:function(A,B){if(this.fireEvent('beforeselect',this,A,B)!==false){this.setFromCurrencyData(B>-1?A.data:false); this.collapse();this.fireEvent('select',this,A,B);}},setFromCurrencyData:function(o){var A='';this.lastCurrency=o;if(this.currencyField){A=!o||typeof(o[this.currencyField])=='undefined'?'':o[this.currencyField];}else{Roo.log('no currencyField value set for '+(this.name?this.name:this.id)); }this.lastSelectionText=A;this.setCurrency(A);},setFromData:function(o){var c={};c[this.currencyField]=!o||typeof(o[this.currencyName])=='undefined'?'':o[this.currencyName];this.setFromCurrencyData(c);var A='';if(this.name){A=!o||typeof(o[this.name])=='undefined'?'':o[this.name]; -- 2.39.2