From b4f95864aac908636b45a3bf4a1b6ed4c1a4f71c Mon Sep 17 00:00:00 2001 From: edward Date: Wed, 25 Apr 2018 16:59:05 +0800 Subject: [PATCH] Roo/bootstrap/ComboBox.js roojs-bootstrap.js roojs-bootstrap-debug.js --- Roo/bootstrap/ComboBox.js | 1 + roojs-bootstrap-debug.js | 2 ++ roojs-bootstrap.js | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Roo/bootstrap/ComboBox.js b/Roo/bootstrap/ComboBox.js index dd65527f4e..894f2dd5ea 100644 --- a/Roo/bootstrap/ComboBox.js +++ b/Roo/bootstrap/ComboBox.js @@ -1657,6 +1657,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.lastQuery != q || this.alwaysQuery){ this.lastQuery = q; if(this.mode == 'local'){ + Roo.log('it is local'); this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 0f1d506a2b..ffc9192a2e 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -14063,6 +14063,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.lastQuery != q || this.alwaysQuery){ this.lastQuery = q; if(this.mode == 'local'){ + Roo.log('it is local'); this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); @@ -40431,6 +40432,7 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, { onCurrencyKeyUp : function(e) { if(!e.isSpecialKey()){ + this.hasFocus = true; this.lastKey = e.getKey(); this.dqTask.delay(this.queryDelay); } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 9a8efaa576..2ffac30e15 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -559,8 +559,8 @@ 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(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();}else{this.store.baseParams[this.queryParam]=q; +;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'){Roo.log('it is 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();}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(); }}Roo.get(document).un('mousedown',this.collapseIf,this);Roo.get(document).un('mousewheel',this.collapseIf,this);if(!this.editable){Roo.get(document).un('keydown',this.listKeyPress,this);}this.fireEvent('collapse',this);this.validate();},collapseIf:function(e){var A=e.within(this.el); @@ -1662,7 +1662,7 @@ v=String(v).replace(".",this.decimalSeparator);this.value=v;if(this.rendered){th }if(Bthis.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false;}return true;},validate:function(){if(this.disabled){this.markValid(); return true;}var A=this.getCurrency();if(this.validateValue(this.getRawValue())&&A.length){this.markValid();return true;}this.markInvalid();return false;},getName:function(){return this.name;},beforeBlur:function(){if(!this.castInt){return;}var v=this.parseValue(this.getRawValue()); if(v){this.setValue(v);}},onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue); -}this.fireEvent("blur",this);},onCurrencyKeyUp:function(e){if(!e.isSpecialKey()){this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},inputEl:function(){return this.el.select('.roo-money-amount-input',true).first();},currencyEl:function(){return this.el.select('.roo-money-currency-input',true).first(); +}this.fireEvent("blur",this);},onCurrencyKeyUp:function(e){if(!e.isSpecialKey()){this.hasFocus=true;this.lastKey=e.getKey();this.dqTask.delay(this.queryDelay);}},inputEl:function(){return this.el.select('.roo-money-amount-input',true).first();},currencyEl:function(){return this.el.select('.roo-money-currency-input',true).first(); },initQuery:function(){var v=this.getCurrency();this.doQuery(v);},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var A=r.data[this.currencyField];var B=A.length;var C=this.getCurrency().length;if(C!=B){this.setCurrency(A);this.selectText(C,A.length); }}},selectText:function(A,B){var v=this.getCurrency();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(A,B);}else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A); C.moveEnd("character",v.length-B);C.select();}}}}); -- 2.39.2