From 0537f7948296b72d9b818218e772a7ac143d31f7 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 12 Sep 2023 16:28:52 +0800 Subject: [PATCH] fix combobox reseting after clicking on it --- Roo/form/ComboBox.js | 6 +++++- roojs-all.js | 2 +- roojs-debug.js | 6 +++++- roojs-ui-debug.js | 6 +++++- roojs-ui.js | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Roo/form/ComboBox.js b/Roo/form/ComboBox.js index 19c5ff9dd0..34d86d0606 100644 --- a/Roo/form/ComboBox.js +++ b/Roo/form/ComboBox.js @@ -1070,7 +1070,11 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, { this.view.select(match); var sn = Roo.get(this.view.getSelectedNodes()[0]); sn.scrollIntoView(sn.dom.parentNode, false); - } + }, + cleanLeadingSpace : function() + { + // override textfield strip white space (trigers set on blur) + } /** * @cfg {Boolean} grow diff --git a/roojs-all.js b/roojs-all.js index 5ed8c8f8c8..eae93bd206 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1794,7 +1794,7 @@ if(!this.editable){Roo.get(document).un('keydown',this.listKeyPress,this);}this. },onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else{this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else{this.doQuery(this.getRawValue()); }if(!this.blockFocus){this.el.focus();}}},listKeyPress:function(e){if(e.isSpecialKey()){return false;}var k=String.fromCharCode(e.getKey()).toUpperCase();var A=false;var B=this.view.getSelectedNodes();var C=false;if(B.length){var ix=this.view.indexOf(B[0]); C=this.store.getAt(ix);if(!C.get(this.displayField)||C.get(this.displayField).substring(0,1).toUpperCase()!=k){C=false;}}this.store.each(function(v){if(C){if(C.id==v.id){C=false;}return;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v); -return false;}},this);if(A===false){return true;}this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0]);sn.scrollIntoView(sn.dom.parentNode,false);}}); +return false;}},this);if(A===false){return true;}this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0]);sn.scrollIntoView(sn.dom.parentNode,false);},cleanLeadingSpace:function(){}}); // Roo/form/ComboBoxArray.js Roo.form.ComboBoxArray=function(A){this.addEvents({'beforeremove':true,'remove':true});Roo.form.ComboBoxArray.superclass.constructor.call(this,A);this.items=new Roo.util.MixedCollection(false);};Roo.extend(Roo.form.ComboBoxArray,Roo.form.TextField,{lastData:false,inputType:'hidden',width:300,name:false,hiddenName:false,seperator:',',items:false,hiddenEl:false,el:false,onRender:function(ct,A){this.combo.hiddenName=this.hiddenName?(this.hiddenName+'-subcombo'):this.hiddenName; this.combo.name=this.name?(this.name+'-subcombo'):this.name;this.combo=Roo.factory(this.combo,Roo.form);this.combo.onRender(ct,A);if(typeof(this.combo.width)!='undefined'){this.combo.onResize(this.combo.width,0);}this.combo.initEvents();this.store=this.combo.store; diff --git a/roojs-debug.js b/roojs-debug.js index da6bc80fa5..b1adb5ec2e 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -43904,7 +43904,11 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, { this.view.select(match); var sn = Roo.get(this.view.getSelectedNodes()[0]); sn.scrollIntoView(sn.dom.parentNode, false); - } + }, + cleanLeadingSpace : function() + { + // override textfield strip white space (trigers set on blur) + } /** * @cfg {Boolean} grow diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 5e974aa51d..dc43590f21 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -19402,7 +19402,11 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, { this.view.select(match); var sn = Roo.get(this.view.getSelectedNodes()[0]); sn.scrollIntoView(sn.dom.parentNode, false); - } + }, + cleanLeadingSpace : function() + { + // override textfield strip white space (trigers set on blur) + } /** * @cfg {Boolean} grow diff --git a/roojs-ui.js b/roojs-ui.js index 97617a4880..4cca78470d 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -847,7 +847,7 @@ if(!this.editable){Roo.get(document).un('keydown',this.listKeyPress,this);}this. },onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else{this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else{this.doQuery(this.getRawValue()); }if(!this.blockFocus){this.el.focus();}}},listKeyPress:function(e){if(e.isSpecialKey()){return false;}var k=String.fromCharCode(e.getKey()).toUpperCase();var A=false;var B=this.view.getSelectedNodes();var C=false;if(B.length){var ix=this.view.indexOf(B[0]); C=this.store.getAt(ix);if(!C.get(this.displayField)||C.get(this.displayField).substring(0,1).toUpperCase()!=k){C=false;}}this.store.each(function(v){if(C){if(C.id==v.id){C=false;}return;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v); -return false;}},this);if(A===false){return true;}this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0]);sn.scrollIntoView(sn.dom.parentNode,false);}}); +return false;}},this);if(A===false){return true;}this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0]);sn.scrollIntoView(sn.dom.parentNode,false);},cleanLeadingSpace:function(){}}); // Roo/form/ComboBoxArray.js Roo.form.ComboBoxArray=function(A){this.addEvents({'beforeremove':true,'remove':true});Roo.form.ComboBoxArray.superclass.constructor.call(this,A);this.items=new Roo.util.MixedCollection(false);};Roo.extend(Roo.form.ComboBoxArray,Roo.form.TextField,{lastData:false,inputType:'hidden',width:300,name:false,hiddenName:false,seperator:',',items:false,hiddenEl:false,el:false,onRender:function(ct,A){this.combo.hiddenName=this.hiddenName?(this.hiddenName+'-subcombo'):this.hiddenName; this.combo.name=this.name?(this.name+'-subcombo'):this.name;this.combo=Roo.factory(this.combo,Roo.form);this.combo.onRender(ct,A);if(typeof(this.combo.width)!='undefined'){this.combo.onResize(this.combo.width,0);}this.combo.initEvents();this.store=this.combo.store; -- 2.39.2