From: edward Date: Wed, 25 Apr 2018 09:03:14 +0000 (+0800) Subject: Roo/bootstrap/ComboBox.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=944094b8b578f2cf81982a1b7f8a06b8a06a56c8 Roo/bootstrap/ComboBox.js roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/Roo/bootstrap/ComboBox.js b/Roo/bootstrap/ComboBox.js index dbfe5f87f9..eeede96222 100644 --- a/Roo/bootstrap/ComboBox.js +++ b/Roo/bootstrap/ComboBox.js @@ -1143,7 +1143,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(typeof(this.loading) !== 'undefined' && this.loading !== null){ this.loading.hide(); } - Roo.log(this.store.getCount()); + if(this.store.getCount() > 0){ this.expand(); @@ -1657,7 +1657,6 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.lastQuery != q || this.alwaysQuery){ this.lastQuery = q; if(this.mode == 'local'){ - this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); @@ -1676,6 +1675,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { this.onLoad(); + }else{ this.store.baseParams[this.queryParam] = q; diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 8f86e648b7..26e2f5a0bc 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -13545,7 +13545,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(!this.hasFocus){ return; } - Roo.log('run??'); + if(typeof(this.loading) !== 'undefined' && this.loading !== null){ this.loading.hide(); } @@ -14063,7 +14063,6 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { if(this.lastQuery != q || this.alwaysQuery){ this.lastQuery = q; if(this.mode == 'local'){ - this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); @@ -14082,6 +14081,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, { this.onLoad(); + }else{ this.store.baseParams[this.queryParam] = q; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index aa9e285cbd..c2ea5688ac 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -536,7 +536,7 @@ this.indicator.hide();}},onDestroy:function(){if(this.view){this.view.setStore(n this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);}Roo.bootstrap.ComboBox.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e); }},onResize:function(w,h){},setEditable:function(A){if(A==this.editable){return;}this.editable=A;if(!A){this.inputEl().dom.setAttribute('readOnly',true);this.inputEl().on('mousedown',this.onTriggerClick,this);this.inputEl().addClass('x-combo-noedit');}else{this.inputEl().dom.setAttribute('readOnly',false); this.inputEl().un('mousedown',this.onTriggerClick,this);this.inputEl().removeClass('x-combo-noedit');}},onBeforeLoad:function(A,B){if(!this.hasFocus){return;}if(!B.add){this.list.dom.innerHTML='
  • '+(this.loadingText||'loading')+'
  • '; -}this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){this.hasQuery=false;if(!this.hasFocus){return;}Roo.log('run??');if(typeof(this.loading)!=='undefined'&&this.loading!==null){this.loading.hide();}if(this.store.getCount()>0){this.expand();this.restrictHeight(); +}this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){this.hasQuery=false;if(!this.hasFocus){return;}if(typeof(this.loading)!=='undefined'&&this.loading!==null){this.loading.hide();}if(this.store.getCount()>0){this.expand();this.restrictHeight(); if(this.lastQuery==this.allQuery){if(this.editable&&!this.tickable){this.inputEl().dom.select();}if(!this.selectByValue(this.value,true)&&this.autoFocus&&(!this.store.lastOptions||typeof(this.store.lastOptions.add)=='undefined'||this.store.lastOptions.add!=true)){this.select(0,true); }}else{if(this.autoFocus){this.selectNext();}if(this.typeAhead&&this.lastKey!=Roo.EventObject.BACKSPACE&&this.lastKey!=Roo.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);}}}else{this.onEmptyResults();}},onLoadException:function(){this.hasQuery=false; if(typeof(this.loading)!=='undefined'&&this.loading!==null){this.loading.hide();}if(this.tickable&&this.editable){return;}this.collapse();},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var A=r.data[this.displayField];var B=A.length;