From ed678b70b0bdec469fad4063761dcc4fc8a840cf Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 10 Feb 2020 15:12:57 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- roojs-all.js | 6 +++--- roojs-debug.js | 36 ++++++++++++++++++++++++------------ roojs-ui-debug.js | 36 ++++++++++++++++++++++++------------ roojs-ui.js | 6 +++--- 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/roojs-all.js b/roojs-all.js index 4f954e1cdf..634eded6f8 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1775,9 +1775,9 @@ this.list.endUpdate();},onBeforeLoad:function(){if(!this.hasFocus){return;}this. if(!this.isLoading){this.setFromData(E.data);}var lw=Math.floor(((this.listWidth*this.maxColumns||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/this.maxColumns);this.stores[C.list+1].loadDataFromChildren(E);var dl=this.stores[C.list+1].getTotalCount(); this.views[C.list+1].getEl().setHeight(this.innerLists[0].getHeight());this.views[C.list+1].getEl().setStyle({display:dl?'block':'none'});this.innerLists[C.list+1].setHeight(this.innerLists[0].getHeight());this.list.setWidth(lw*(C.list+(dl?2:1)));if(this.isLoading){this.selectActive(C.list); }},onDoubleClick:function(){this.collapse();},findRecord:function(A,B){return this.findRecordInStore(this.store,A,B);},findRecordInStore:function(A,B,C){var D=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});var E=this;var F=false;if(A.getCount()<1){return false; -}A.each(function(r){if(r.data[B]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){D.loadDataFromChildren(r);var G=E.findRecordInStore(D,B,C);if(G!==false){F=G;return false;}}return true;});return F;},selectActive:function(A){var B=this.getValue();var C=this.hiddenName; -var D=this.stores[A];if(D.getCount()<1){return;}D.each(function(r){if(r.data[C]==B){record=r;return false;}if(r.data.cn&&r.data.cn.length){cstore.loadDataFromChildren(r);var E=_this.findRecordInStore(cstore,C,B);if(E!==false){record=E;return false;}}return true; -});}}); +}A.each(function(r){if(r.data[B]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){D.loadDataFromChildren(r);var G=E.findRecordInStore(D,B,C);if(G!==false){F=G;return false;}}return true;});return F;},selectActive:function(A){var B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]} +);var C=this.getValue();var D=this.hiddenName;var E=this.stores[A];if(E.getCount()<1){return;}var F=false;E.each(function(r){if(r.data[D]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){B.loadDataFromChildren(r);var G=_this.findRecordInStore(B,D,C); +if(G!==false){F=r;return false;}}return true;});if(F!==false){var ix=E.getIndexOf(F);this.views[A].function(ix,false,true);}}}); // Roo/form/Checkbox.js Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"} ,boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments); diff --git a/roojs-debug.js b/roojs-debug.js index 2336d5b10c..0aa8f5ad20 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -43069,6 +43069,11 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { selectActive : function (lvl) { + var cstore = new Roo.data.SimpleStore({ + //fields : this.store.reader.meta.fields, // we need array reader.. for + reader : this.store.reader, + data : [ ] + }); // just need to determine which of the current level is selected if any.. var value = this.getValue(); var prop = this.hiddenName; @@ -43076,22 +43081,29 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { if(store.getCount() < 1){ return; } + var record = false; store.each(function(r){ + // selected is at this level if(r.data[prop] == value){ - record = r; - return false; - } - if (r.data.cn && r.data.cn.length) { - cstore.loadDataFromChildren( r); - var cret = _this.findRecordInStore(cstore, prop, value); - if (cret !== false) { - record = cret; - return false; - } - } + record = r; + return false; + } + + if (r.data.cn && r.data.cn.length) { + cstore.loadDataFromChildren( r); + var cret = _this.findRecordInStore(cstore, prop, value); + if (cret !== false) { + record = r; + return false; + } + } - return true; + return true; }); + if (record !== false) { + var ix = store.getIndexOf(record); + this.views[lvl].function(ix, false, true); // will not trigger select change.. + } } diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 1356457aa0..c7f1e2db44 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -20585,6 +20585,11 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { selectActive : function (lvl) { + var cstore = new Roo.data.SimpleStore({ + //fields : this.store.reader.meta.fields, // we need array reader.. for + reader : this.store.reader, + data : [ ] + }); // just need to determine which of the current level is selected if any.. var value = this.getValue(); var prop = this.hiddenName; @@ -20592,22 +20597,29 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { if(store.getCount() < 1){ return; } + var record = false; store.each(function(r){ + // selected is at this level if(r.data[prop] == value){ - record = r; - return false; - } - if (r.data.cn && r.data.cn.length) { - cstore.loadDataFromChildren( r); - var cret = _this.findRecordInStore(cstore, prop, value); - if (cret !== false) { - record = cret; - return false; - } - } + record = r; + return false; + } + + if (r.data.cn && r.data.cn.length) { + cstore.loadDataFromChildren( r); + var cret = _this.findRecordInStore(cstore, prop, value); + if (cret !== false) { + record = r; + return false; + } + } - return true; + return true; }); + if (record !== false) { + var ix = store.getIndexOf(record); + this.views[lvl].function(ix, false, true); // will not trigger select change.. + } } diff --git a/roojs-ui.js b/roojs-ui.js index 7f3a122bc4..459485f945 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -905,9 +905,9 @@ this.list.endUpdate();},onBeforeLoad:function(){if(!this.hasFocus){return;}this. if(!this.isLoading){this.setFromData(E.data);}var lw=Math.floor(((this.listWidth*this.maxColumns||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/this.maxColumns);this.stores[C.list+1].loadDataFromChildren(E);var dl=this.stores[C.list+1].getTotalCount(); this.views[C.list+1].getEl().setHeight(this.innerLists[0].getHeight());this.views[C.list+1].getEl().setStyle({display:dl?'block':'none'});this.innerLists[C.list+1].setHeight(this.innerLists[0].getHeight());this.list.setWidth(lw*(C.list+(dl?2:1)));if(this.isLoading){this.selectActive(C.list); }},onDoubleClick:function(){this.collapse();},findRecord:function(A,B){return this.findRecordInStore(this.store,A,B);},findRecordInStore:function(A,B,C){var D=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});var E=this;var F=false;if(A.getCount()<1){return false; -}A.each(function(r){if(r.data[B]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){D.loadDataFromChildren(r);var G=E.findRecordInStore(D,B,C);if(G!==false){F=G;return false;}}return true;});return F;},selectActive:function(A){var B=this.getValue();var C=this.hiddenName; -var D=this.stores[A];if(D.getCount()<1){return;}D.each(function(r){if(r.data[C]==B){record=r;return false;}if(r.data.cn&&r.data.cn.length){cstore.loadDataFromChildren(r);var E=_this.findRecordInStore(cstore,C,B);if(E!==false){record=E;return false;}}return true; -});}}); +}A.each(function(r){if(r.data[B]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){D.loadDataFromChildren(r);var G=E.findRecordInStore(D,B,C);if(G!==false){F=G;return false;}}return true;});return F;},selectActive:function(A){var B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]} +);var C=this.getValue();var D=this.hiddenName;var E=this.stores[A];if(E.getCount()<1){return;}var F=false;E.each(function(r){if(r.data[D]==C){F=r;return false;}if(r.data.cn&&r.data.cn.length){B.loadDataFromChildren(r);var G=_this.findRecordInStore(B,D,C); +if(G!==false){F=r;return false;}}return true;});if(F!==false){var ix=E.getIndexOf(F);this.views[A].function(ix,false,true);}}}); // Roo/form/Checkbox.js Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"} ,boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments); -- 2.39.2