From: Alan Knowles Date: Mon, 10 Feb 2020 05:01:52 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=564ef008a504951a7b271e7c726d173870509c72 roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index 4c68db432e..f0ac83cab1 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1764,13 +1764,13 @@ Roo.form.ComboNested=function(A){Roo.form.ComboCheck.superclass.constructor.call }this.innerLists=[];this.views=[];this.stores=[];for(var i=0;i<3;i++){this.onRenderList(B,i);}this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.Toolbar(this.footer);var C=this;this.pageTb.add({text:'Done',handler:function(){C.collapse(); }});if(this.allowBlank&&!this.disableClear){this.pageTb.add(new Roo.Toolbar.Fill(),{cls:'x-btn-icon x-btn-clear',text:' ',handler:function(){C.collapse();C.clearValue();C.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight(); }},onRenderList:function(A,i){var lw=Math.floor(((this.listWidth*3||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/3);this.list.setWidth(lw);var il=this.innerLists[i]=this.list.createChild({cls:A+'-inner'});il.setWidth(lw); -il.setStyle({'overflow-x':'hidden'});if(!this.tpl){this.tpl=new Roo.Template({html:'
{'+this.displayField+'}
',isEmpty:function(D,E){Roo.log(D);var dl=typeof(D.data)!='undefined'?D.data.total:D.length; -return dl?'has-children':'no-children'}});}var B=this.store;if(i>0){B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});}this.stores[i]=B;var C=this.views[i]=new Roo.View(il,this.tpl,{singleSelect:true,store:B,selectedClass:this.selectedClass}); -C.getEl().setWidth(lw);C.getEl().setStyle({position:i<1?'relative':'absolute',top:0,left:(i*lw)+'px',display:i>0?'none':'block'});C.on('selectionchange',this.onSelectChange,this,{list:i});C.on('dblclick',this.onDoubleClick,this,{list:i});B.on('beforeload',this.onBeforeLoad,this); -B.on('load',this.onLoad,this,{list:i});B.on('loadexception',this.onLoadException,this);},onResize:function(){},restrictHeight:function(){var mh=0;Roo.each(this.innerLists,function(il,i){var el=this.views[i].getEl();el.dom.style.height='';var A=el.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight); -if(i<1){el.setHeight(h'+this.loadingText+'':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(a,b,c,d){if(!this.hasFocus){return; -}if(this.store.getCount()>0){this.expand();this.restrictHeight();}else{this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg); +il.setStyle({'overflow-x':'hidden'});if(!this.tpl){this.tpl=new Roo.Template({html:'
{'+this.displayField+'}
',isEmpty:function(D,E){var dl=typeof(D.data)!='undefined'?D.data.length:D.length;return dl?'has-children':'no-children'} +});}var B=this.store;if(i>0){B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});}this.stores[i]=B;var C=this.views[i]=new Roo.View(il,this.tpl,{singleSelect:true,store:B,selectedClass:this.selectedClass});C.getEl().setWidth(lw);C.getEl().setStyle({position:i<1?'relative':'absolute',top:0,left:(i*lw)+'px',display:i>0?'none':'block'} +);C.on('selectionchange',this.onSelectChange,this,{list:i});C.on('dblclick',this.onDoubleClick,this,{list:i});B.on('beforeload',this.onBeforeLoad,this);B.on('load',this.onLoad,this,{list:i});B.on('loadexception',this.onLoadException,this);},onResize:function(){} +,restrictHeight:function(){var mh=0;Roo.each(this.innerLists,function(il,i){var el=this.views[i].getEl();el.dom.style.height='';var A=el.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight);if(i<1){el.setHeight(h'+this.loadingText+'':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(a,b,c,d){if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight(); +}else{this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg); }},onSelectChange:function(A,B,C){var ix=A.getSelectedIndexes();if(C.list>1){this.setFromData(ix.length?A.store.getAt(ix[0]).data:{});return;}if(!ix.length){this.setFromData({});this.stores[C.list+1].loadData([]);return;}var D=A.store.getAt(ix[0]);this.setFromData(D.data); var lw=Math.floor(((this.listWidth*3||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/3);var E=typeof(D.data.cn)=='undefined'?[]:D.data.cn;var dl=typeof(E.data.cn)!='undefined'?E.data.total:E.length;this.stores[C.list+1].loadData(E); 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)));},onDoubleClick:function(){this.collapse(); diff --git a/roojs-debug.js b/roojs-debug.js index eb2176c347..b29d0cdd35 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -42814,8 +42814,8 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { this.tpl = new Roo.Template({ html : '
{' + this.displayField + '}
', isEmpty: function (value, allValues) { - Roo.log(value); - var dl = typeof(value.data) != 'undefined' ? value.data.total : value.length; ///json is a nested response.. + //Roo.log(value); + var dl = typeof(value.data) != 'undefined' ? value.data.length : value.length; ///json is a nested response.. return dl ? 'has-children' : 'no-children' } }); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index c21c4f406b..117351beda 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -20330,8 +20330,8 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, { this.tpl = new Roo.Template({ html : '
{' + this.displayField + '}
', isEmpty: function (value, allValues) { - Roo.log(value); - var dl = typeof(value.data) != 'undefined' ? value.data.total : value.length; ///json is a nested response.. + //Roo.log(value); + var dl = typeof(value.data) != 'undefined' ? value.data.length : value.length; ///json is a nested response.. return dl ? 'has-children' : 'no-children' } }); diff --git a/roojs-ui.js b/roojs-ui.js index 8d0692a275..b5b96798cb 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -894,13 +894,13 @@ Roo.form.ComboNested=function(A){Roo.form.ComboCheck.superclass.constructor.call }this.innerLists=[];this.views=[];this.stores=[];for(var i=0;i<3;i++){this.onRenderList(B,i);}this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.Toolbar(this.footer);var C=this;this.pageTb.add({text:'Done',handler:function(){C.collapse(); }});if(this.allowBlank&&!this.disableClear){this.pageTb.add(new Roo.Toolbar.Fill(),{cls:'x-btn-icon x-btn-clear',text:' ',handler:function(){C.collapse();C.clearValue();C.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight(); }},onRenderList:function(A,i){var lw=Math.floor(((this.listWidth*3||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/3);this.list.setWidth(lw);var il=this.innerLists[i]=this.list.createChild({cls:A+'-inner'});il.setWidth(lw); -il.setStyle({'overflow-x':'hidden'});if(!this.tpl){this.tpl=new Roo.Template({html:'
{'+this.displayField+'}
',isEmpty:function(D,E){Roo.log(D);var dl=typeof(D.data)!='undefined'?D.data.total:D.length; -return dl?'has-children':'no-children'}});}var B=this.store;if(i>0){B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});}this.stores[i]=B;var C=this.views[i]=new Roo.View(il,this.tpl,{singleSelect:true,store:B,selectedClass:this.selectedClass}); -C.getEl().setWidth(lw);C.getEl().setStyle({position:i<1?'relative':'absolute',top:0,left:(i*lw)+'px',display:i>0?'none':'block'});C.on('selectionchange',this.onSelectChange,this,{list:i});C.on('dblclick',this.onDoubleClick,this,{list:i});B.on('beforeload',this.onBeforeLoad,this); -B.on('load',this.onLoad,this,{list:i});B.on('loadexception',this.onLoadException,this);},onResize:function(){},restrictHeight:function(){var mh=0;Roo.each(this.innerLists,function(il,i){var el=this.views[i].getEl();el.dom.style.height='';var A=el.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight); -if(i<1){el.setHeight(h'+this.loadingText+'':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(a,b,c,d){if(!this.hasFocus){return; -}if(this.store.getCount()>0){this.expand();this.restrictHeight();}else{this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg); +il.setStyle({'overflow-x':'hidden'});if(!this.tpl){this.tpl=new Roo.Template({html:'
{'+this.displayField+'}
',isEmpty:function(D,E){var dl=typeof(D.data)!='undefined'?D.data.length:D.length;return dl?'has-children':'no-children'} +});}var B=this.store;if(i>0){B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});}this.stores[i]=B;var C=this.views[i]=new Roo.View(il,this.tpl,{singleSelect:true,store:B,selectedClass:this.selectedClass});C.getEl().setWidth(lw);C.getEl().setStyle({position:i<1?'relative':'absolute',top:0,left:(i*lw)+'px',display:i>0?'none':'block'} +);C.on('selectionchange',this.onSelectChange,this,{list:i});C.on('dblclick',this.onDoubleClick,this,{list:i});B.on('beforeload',this.onBeforeLoad,this);B.on('load',this.onLoad,this,{list:i});B.on('loadexception',this.onLoadException,this);},onResize:function(){} +,restrictHeight:function(){var mh=0;Roo.each(this.innerLists,function(il,i){var el=this.views[i].getEl();el.dom.style.height='';var A=el.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight);if(i<1){el.setHeight(h'+this.loadingText+'':'');this.restrictHeight();this.selectedIndex=-1;},onLoad:function(a,b,c,d){if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight(); +}else{this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg); }},onSelectChange:function(A,B,C){var ix=A.getSelectedIndexes();if(C.list>1){this.setFromData(ix.length?A.store.getAt(ix[0]).data:{});return;}if(!ix.length){this.setFromData({});this.stores[C.list+1].loadData([]);return;}var D=A.store.getAt(ix[0]);this.setFromData(D.data); var lw=Math.floor(((this.listWidth*3||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/3);var E=typeof(D.data.cn)=='undefined'?[]:D.data.cn;var dl=typeof(E.data.cn)!='undefined'?E.data.total:E.length;this.stores[C.list+1].loadData(E); 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)));},onDoubleClick:function(){this.collapse();