From: Alan Knowles Date: Mon, 10 Feb 2020 07:07:54 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=dad1e7bd00322fecfa995ace623dd4389904f365 roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js Roo/form/ComboNested.js --- diff --git a/Roo/form/ComboNested.js b/Roo/form/ComboNested.js index db506672d6..cc9114e715 100644 --- a/Roo/form/ComboNested.js +++ b/Roo/form/ComboNested.js @@ -342,20 +342,20 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { return false; } store.each(function(r){ - if(r.data[prop] == value){ - record = r; - return false; - } - if (r.data.cn && r.data.cn.length) { + 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; } - } + } - return true; + return true; }); return record; diff --git a/roojs-all.js b/roojs-all.js index e1ecfbd8a9..4f954e1cdf 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1774,8 +1774,10 @@ this.list.endUpdate();},onBeforeLoad:function(){if(!this.hasFocus){return;}this. }},onSelectChange:function(A,B,C){var ix=A.getSelectedIndexes();if(C.list>this.maxColumns-2){this.setFromData(ix.length?A.store.getAt(ix[0]).data:{});return;}if(!ix.length){this.setFromData({});var D=this.stores[C.list+1];D.removeAll();return;}var E=A.store.getAt(ix[0]); 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()>0){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;},function selectActive()}); +}},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; +});}}); // 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 d32eded9ff..2336d5b10c 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -43042,28 +43042,58 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { }); var _this = this; var record = false; - if(store.getCount() > 0){ - store.each(function(r){ - if(r.data[prop] == value){ - record = r; + if(store.getCount() < 1){ + return false; + } + store.each(function(r){ + 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; } - 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; - } - } - - return true; - }); - } + } + + return true; + }); + return record; }, - function selectActive() + + + selectActive : function (lvl) + { + // just need to determine which of the current level is selected if any.. + var value = this.getValue(); + var prop = this.hiddenName; + var store = this.stores[lvl]; + if(store.getCount() < 1){ + return; + } + store.each(function(r){ + 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; + } + } + + return true; + }); + + } diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index abb0bf8c3b..1356457aa0 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -20558,28 +20558,58 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { }); var _this = this; var record = false; - if(store.getCount() > 0){ - store.each(function(r){ - if(r.data[prop] == value){ - record = r; + if(store.getCount() < 1){ + return false; + } + store.each(function(r){ + 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; } - 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; - } - } - - return true; - }); - } + } + + return true; + }); + return record; }, - function selectActive() + + + selectActive : function (lvl) + { + // just need to determine which of the current level is selected if any.. + var value = this.getValue(); + var prop = this.hiddenName; + var store = this.stores[lvl]; + if(store.getCount() < 1){ + return; + } + store.each(function(r){ + 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; + } + } + + return true; + }); + + } diff --git a/roojs-ui.js b/roojs-ui.js index b51448bff9..7f3a122bc4 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -904,8 +904,10 @@ this.list.endUpdate();},onBeforeLoad:function(){if(!this.hasFocus){return;}this. }},onSelectChange:function(A,B,C){var ix=A.getSelectedIndexes();if(C.list>this.maxColumns-2){this.setFromData(ix.length?A.store.getAt(ix[0]).data:{});return;}if(!ix.length){this.setFromData({});var D=this.stores[C.list+1];D.removeAll();return;}var E=A.store.getAt(ix[0]); 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()>0){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;},function selectActive()}); +}},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; +});}}); // 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);