roojs-ui.js
authorAlan Knowles <alan@roojs.com>
Fri, 7 Feb 2020 06:59:40 +0000 (14:59 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 7 Feb 2020 06:59:40 +0000 (14:59 +0800)
roojs-ui-debug.js
roojs-all.js
roojs-debug.js
roojs-core.js
roojs-core-debug.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 2822adc..424cbda 100644 (file)
@@ -1756,6 +1756,25 @@ return true;}return false;},validateValue:function(A){return Roo.form.ComboBoxAr
 if(!this.el){var B=this.getAutoCreate();this.el=ct.createChild(B,A);}this.el.child('img').dom.setAttribute('src',Roo.BLANK_IMAGE_URL);this.el.child('div').dom.innerHTML=this.cb.renderer?this.cb.renderer(this.data):String.format('{0}',this.data[this.displayField]);
 this.el.child('div').dom.setAttribute('qtip',String.format('{0}',this.data[this.tipField]));this.el.child('img').on('click',this.remove,this);},remove:function(){if(this.cb.disabled){return;}if(false!==this.cb.fireEvent('beforeremove',this.cb,this)){this.cb.items.remove(this);
 this.el.child('img').un('click',this.remove,this);this.el.remove();this.cb.updateHiddenEl();this.cb.fireEvent('remove',this.cb,this);}}});
+// Roo/form/ComboNested.js
+Roo.form.ComboNested=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboNested : missing value for: "+e;
+}});};Roo.extend(Roo.form.ComboNested,Roo.form.ComboBox,{list:null,innerLists:null,views:null,stores:null,onRender:function(ct,A){Roo.form.ComboBox.superclass.onRender.call(this,ct,A);if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)}
+,'before',true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');}if(Roo.isGecko){this.el.dom.setAttribute('autocomplete','off');}var B='x-combo-list';this.list=new Roo.Layer({shadow:this.shadow,cls:[B,this.listClass].join(' '),constrain:false}
+);var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:B+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();
+}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:'&#160;',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:'<div class="'+A+'-item '+A+'-item-{cn:this.isEmpty}">{'+this.displayField+'}</div>',isEmpty:function(D,E){return D.length?'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.onStoreLoad,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.maxHeight?'auto':this.maxHeight);
+il.setHeight(h<this.maxHeight?'auto':this.maxHeight);mh=Math.max(el.getHeight(),mh);}},this);this.list.beginUpdate();this.list.setHeight(mh+this.list.getFrameWidth('tb')+this.assetHeight);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onLoad:function(a,b,c,d){if(!this.hasFocus){return;
+}if(this.store.getCount()>0){this.expand();this.restrictHeight();}else{this.onEmptyResults();}},onStoreLoad:function(){Roo.log(arguments);},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);this.stores[C.list+1].loadData(typeof(D.data.cn)=='undefined'?[]:D.data.cn);this.views[C.list+1].getEl().setHeight(this.innerLists[0].getHeight());
+this.views[C.list+1].getEl().setStyle({display:D.data.cn.length?'block':'none'});this.innerLists[C.list+1].setHeight(this.innerLists[0].getHeight());this.list.setWidth(lw*(C.list+(D.data.cn.length?2:1)));},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.loadData(r.data.cn);var G=E.findRecordInStore(D,B,C);
+if(G!==false){F=G;return false;}}return true;});}return F;}});
 // 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);
index a9a9f75..72df33b 100644 (file)
@@ -42638,6 +42638,343 @@ Roo.extend(Roo.form.ComboBoxArray.Item, Roo.BoxComponent, {
         }
         
     }
+});/*
+ * RooJS Library 1.1.1
+ * Copyright(c) 2008-2011  Alan Knowles
+ *
+ * License - LGPL
+ */
+
+/**
+ * @class Roo.form.ComboNested
+ * @extends Roo.form.ComboBox
+ * A combobox for that allows selection of nested items in a list,
+ * eg.
+ *
+ *  Book
+ *    -> red
+ *    -> green
+ *  Table
+ *    -> square
+ *      ->red
+ *      ->green
+ *    -> rectangle
+ *      ->green
+ *      
+ * 
+ * @constructor
+ * Create a new ComboNested
+ * @param {Object} config Configuration options
+ */
+Roo.form.ComboNested = function(config){
+    Roo.form.ComboCheck.superclass.constructor.call(this, config);
+    // should verify some data...
+    // like
+    // hiddenName = required..
+    // displayField = required
+    // valudField == required
+    var req= [ 'hiddenName', 'displayField', 'valueField' ];
+    var _t = this;
+    Roo.each(req, function(e) {
+        if ((typeof(_t[e]) == 'undefined' ) || !_t[e].length) {
+            throw "Roo.form.ComboNested : missing value for: " + e;
+        }
+    });
+     
+    
+};
+
+Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
+   
+   
+    list : null, // the outermost div..
+    innerLists : null, // the
+    views : null,
+    stores : null,
+    // private
+    onRender : function(ct, position)
+    {
+        Roo.form.ComboBox.superclass.onRender.call(this, ct, position); // skip parent call - got to above..
+        
+       if(this.hiddenName){
+            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id:  (this.hiddenId||this.hiddenName)},
+                    'before', true);
+            this.hiddenField.value =
+                this.hiddenValue !== undefined ? this.hiddenValue :
+                this.value !== undefined ? this.value : '';
+
+            // prevent input submission
+            this.el.dom.removeAttribute('name');
+             
+             
+        }
+       
+        if(Roo.isGecko){
+            this.el.dom.setAttribute('autocomplete', 'off');
+        }
+
+        var cls = 'x-combo-list';
+
+        this.list = new Roo.Layer({
+            shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
+        });
+
+        var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
+        this.list.setWidth(lw);
+        this.list.swallowEvent('mousewheel');
+        this.assetHeight = 0;
+
+        if(this.title){
+            this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
+            this.assetHeight += this.header.getHeight();
+        }
+        this.innerLists = [];
+        this.views = [];
+        this.stores = [];
+        for (var i =0 ; i < 3; i++) {
+            this.onRenderList( cls, i);
+        }
+        
+        // always needs footer, as we are going to have an 'OK' button.
+        this.footer = this.list.createChild({cls:cls+'-ft'});
+        this.pageTb = new Roo.Toolbar(this.footer);  
+        var _this = this;
+        this.pageTb.add(  {
+            
+            text: 'Done',
+            handler: function()
+            {
+                _this.collapse();
+            }
+        });
+        
+        if ( this.allowBlank && !this.disableClear) {
+            
+            this.pageTb.add(new Roo.Toolbar.Fill(), {
+                cls: 'x-btn-icon x-btn-clear',
+                text: '&#160;',
+                handler: function()
+                {
+                    _this.collapse();
+                    _this.clearValue();
+                    _this.onSelect(false, -1);
+                }
+            });
+        }
+        if (this.footer) {
+            this.assetHeight += this.footer.getHeight();
+        }
+        
+    },
+    onRenderList : function (  cls, i)
+    {
+        
+        var lw = Math.floor(
+                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+        );
+        
+        this.list.setWidth(lw); // default to '1'
+
+        var il = this.innerLists[i] = this.list.createChild({cls:cls+'-inner'});
+        //il.on('mouseover', this.onViewOver, this, { list:  i });
+        //il.on('mousemove', this.onViewMove, this, { list:  i });
+        il.setWidth(lw);
+        il.setStyle({ 'overflow-x' : 'hidden'});
+
+        if(!this.tpl){
+            this.tpl = new Roo.Template({
+                html :  '<div class="'+cls+'-item '+cls+'-item-{cn:this.isEmpty}">{' + this.displayField + '}</div>',
+                isEmpty: function (value, allValues) {
+                    return value.length ? 'has-children' : 'no-children'
+                }
+            });
+        }
+        
+        var store  = this.store;
+        if (i > 0) {
+            store  = new Roo.data.SimpleStore({
+                reader : this.store.reader,
+                data : [ ]
+            });
+        }
+        this.stores[i]  = store;
+                
+        
+        
+        var view = this.views[i] = new Roo.View(
+            il,
+            this.tpl,
+            {
+                singleSelect:true,
+                store: store,
+                selectedClass: this.selectedClass
+            }
+        );
+        view.getEl().setWidth(lw);
+        view.getEl().setStyle({
+            position: i < 1 ? 'relative' : 'absolute',
+            top: 0,
+            left: (i * lw ) + 'px',
+            display : i > 0 ? 'none' : 'block'
+        });
+        view.on('selectionchange', this.onSelectChange, this, {list : i });
+        view.on('dblclick', this.onDoubleClick, this, {list : i });
+        //view.on('click', this.onViewClick, this, { list : i });
+
+        store.on('beforeload', this.onBeforeLoad, this);
+        store.on('load',  this.onStoreLoad, this, { list  : i});
+        store.on('loadexception', this.onLoadException, this);
+
+        // hide the other vies..
+        
+        
+        
+    },
+    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 inner = el.dom;
+            var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
+            // only adjust heights on other ones..
+            if (i < 1) {
+                
+                el.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
+                il.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
+                mh = Math.max(el.getHeight(), mh);
+            }
+            
+            
+        }, this);
+        
+        this.list.beginUpdate();
+        this.list.setHeight(mh+this.list.getFrameWidth('tb')+this.assetHeight);
+        this.list.alignTo(this.el, this.listAlign);
+        this.list.endUpdate();
+        
+    },
+     
+    
+    // -- store handlers..
+    
+    // private
+    onLoad : function(a,b,c,d)
+    {
+        
+        if(!this.hasFocus){
+            return;
+        }
+        
+        if(this.store.getCount() > 0) {
+            this.expand();
+            this.restrictHeight();   
+        } else {
+            this.onEmptyResults();
+        }
+        /*
+        this.stores[1].loadData([]);
+        this.stores[2].loadData([]);
+        this.views
+        */    
+    
+        //this.el.focus();
+    },
+    onStoreLoad : function ()
+    {
+        Roo.log(arguments);
+    },
+    
+    // private
+    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 (view, sels, opts )
+    {
+        var ix = view.getSelectedIndexes();
+        
+        
+        if (opts.list > 1) {
+             
+            this.setFromData(ix.length ? view.store.getAt(ix[0]).data : {});
+            return;
+        }
+        
+        if (!ix.length) {
+            this.setFromData({});
+            this.stores[opts.list+1].loadData( [] );
+            return;
+        }
+        
+        var rec = view.store.getAt(ix[0]);
+        this.setFromData(rec.data);
+        
+        var lw = Math.floor(
+                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+        );
+        
+        this.stores[opts.list+1].loadData( typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn);
+        this.views[opts.list+1].getEl().setHeight( this.innerLists[0].getHeight());
+        this.views[opts.list+1].getEl().setStyle({ display : rec.data.cn.length ? 'block' : 'none' });
+        this.innerLists[opts.list+1].setHeight( this.innerLists[0].getHeight());
+        this.list.setWidth(lw * (opts.list + (rec.data.cn.length ? 2 : 1))); 
+    },
+    onDoubleClick : function()
+    {
+        this.collapse(); //??
+    },
+    
+     
+    
+    findRecord : function (prop,value)
+    {
+        return this.findRecordInStore(this.store, prop,value);
+    },
+    
+     // private
+    findRecordInStore : function(store, prop, value)
+    {
+        var cstore = new Roo.data.SimpleStore({
+            reader : this.store.reader,
+            data : [ ]
+        });
+        var _this = this;
+        var record  = false;
+        if(store.getCount() > 0){
+           store.each(function(r){
+                if(r.data[prop] == value){
+                    record = r;
+                    return false;
+                }
+                if (r.data.cn && r.data.cn.length) {
+                    cstore.loadData( r.data.cn);
+                    var cret = _this.findRecordInStore(cstore, prop, value);
+                    if (cret !== false) {
+                        record = cret;
+                        return false;
+                    }
+                }
+                
+                return true;
+            });
+        }
+        return record;
+    }
+    
 });/*
  * Based on:
  * Ext JS Library 1.1.1
index 4ef5d5d..6e8802e 100644 (file)
@@ -20182,6 +20182,343 @@ Roo.extend(Roo.form.ComboBoxArray.Item, Roo.BoxComponent, {
         }
         
     }
+});/*
+ * RooJS Library 1.1.1
+ * Copyright(c) 2008-2011  Alan Knowles
+ *
+ * License - LGPL
+ */
+
+/**
+ * @class Roo.form.ComboNested
+ * @extends Roo.form.ComboBox
+ * A combobox for that allows selection of nested items in a list,
+ * eg.
+ *
+ *  Book
+ *    -> red
+ *    -> green
+ *  Table
+ *    -> square
+ *      ->red
+ *      ->green
+ *    -> rectangle
+ *      ->green
+ *      
+ * 
+ * @constructor
+ * Create a new ComboNested
+ * @param {Object} config Configuration options
+ */
+Roo.form.ComboNested = function(config){
+    Roo.form.ComboCheck.superclass.constructor.call(this, config);
+    // should verify some data...
+    // like
+    // hiddenName = required..
+    // displayField = required
+    // valudField == required
+    var req= [ 'hiddenName', 'displayField', 'valueField' ];
+    var _t = this;
+    Roo.each(req, function(e) {
+        if ((typeof(_t[e]) == 'undefined' ) || !_t[e].length) {
+            throw "Roo.form.ComboNested : missing value for: " + e;
+        }
+    });
+     
+    
+};
+
+Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
+   
+   
+    list : null, // the outermost div..
+    innerLists : null, // the
+    views : null,
+    stores : null,
+    // private
+    onRender : function(ct, position)
+    {
+        Roo.form.ComboBox.superclass.onRender.call(this, ct, position); // skip parent call - got to above..
+        
+       if(this.hiddenName){
+            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id:  (this.hiddenId||this.hiddenName)},
+                    'before', true);
+            this.hiddenField.value =
+                this.hiddenValue !== undefined ? this.hiddenValue :
+                this.value !== undefined ? this.value : '';
+
+            // prevent input submission
+            this.el.dom.removeAttribute('name');
+             
+             
+        }
+       
+        if(Roo.isGecko){
+            this.el.dom.setAttribute('autocomplete', 'off');
+        }
+
+        var cls = 'x-combo-list';
+
+        this.list = new Roo.Layer({
+            shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
+        });
+
+        var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
+        this.list.setWidth(lw);
+        this.list.swallowEvent('mousewheel');
+        this.assetHeight = 0;
+
+        if(this.title){
+            this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
+            this.assetHeight += this.header.getHeight();
+        }
+        this.innerLists = [];
+        this.views = [];
+        this.stores = [];
+        for (var i =0 ; i < 3; i++) {
+            this.onRenderList( cls, i);
+        }
+        
+        // always needs footer, as we are going to have an 'OK' button.
+        this.footer = this.list.createChild({cls:cls+'-ft'});
+        this.pageTb = new Roo.Toolbar(this.footer);  
+        var _this = this;
+        this.pageTb.add(  {
+            
+            text: 'Done',
+            handler: function()
+            {
+                _this.collapse();
+            }
+        });
+        
+        if ( this.allowBlank && !this.disableClear) {
+            
+            this.pageTb.add(new Roo.Toolbar.Fill(), {
+                cls: 'x-btn-icon x-btn-clear',
+                text: '&#160;',
+                handler: function()
+                {
+                    _this.collapse();
+                    _this.clearValue();
+                    _this.onSelect(false, -1);
+                }
+            });
+        }
+        if (this.footer) {
+            this.assetHeight += this.footer.getHeight();
+        }
+        
+    },
+    onRenderList : function (  cls, i)
+    {
+        
+        var lw = Math.floor(
+                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+        );
+        
+        this.list.setWidth(lw); // default to '1'
+
+        var il = this.innerLists[i] = this.list.createChild({cls:cls+'-inner'});
+        //il.on('mouseover', this.onViewOver, this, { list:  i });
+        //il.on('mousemove', this.onViewMove, this, { list:  i });
+        il.setWidth(lw);
+        il.setStyle({ 'overflow-x' : 'hidden'});
+
+        if(!this.tpl){
+            this.tpl = new Roo.Template({
+                html :  '<div class="'+cls+'-item '+cls+'-item-{cn:this.isEmpty}">{' + this.displayField + '}</div>',
+                isEmpty: function (value, allValues) {
+                    return value.length ? 'has-children' : 'no-children'
+                }
+            });
+        }
+        
+        var store  = this.store;
+        if (i > 0) {
+            store  = new Roo.data.SimpleStore({
+                reader : this.store.reader,
+                data : [ ]
+            });
+        }
+        this.stores[i]  = store;
+                
+        
+        
+        var view = this.views[i] = new Roo.View(
+            il,
+            this.tpl,
+            {
+                singleSelect:true,
+                store: store,
+                selectedClass: this.selectedClass
+            }
+        );
+        view.getEl().setWidth(lw);
+        view.getEl().setStyle({
+            position: i < 1 ? 'relative' : 'absolute',
+            top: 0,
+            left: (i * lw ) + 'px',
+            display : i > 0 ? 'none' : 'block'
+        });
+        view.on('selectionchange', this.onSelectChange, this, {list : i });
+        view.on('dblclick', this.onDoubleClick, this, {list : i });
+        //view.on('click', this.onViewClick, this, { list : i });
+
+        store.on('beforeload', this.onBeforeLoad, this);
+        store.on('load',  this.onStoreLoad, this, { list  : i});
+        store.on('loadexception', this.onLoadException, this);
+
+        // hide the other vies..
+        
+        
+        
+    },
+    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 inner = el.dom;
+            var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
+            // only adjust heights on other ones..
+            if (i < 1) {
+                
+                el.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
+                il.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);
+                mh = Math.max(el.getHeight(), mh);
+            }
+            
+            
+        }, this);
+        
+        this.list.beginUpdate();
+        this.list.setHeight(mh+this.list.getFrameWidth('tb')+this.assetHeight);
+        this.list.alignTo(this.el, this.listAlign);
+        this.list.endUpdate();
+        
+    },
+     
+    
+    // -- store handlers..
+    
+    // private
+    onLoad : function(a,b,c,d)
+    {
+        
+        if(!this.hasFocus){
+            return;
+        }
+        
+        if(this.store.getCount() > 0) {
+            this.expand();
+            this.restrictHeight();   
+        } else {
+            this.onEmptyResults();
+        }
+        /*
+        this.stores[1].loadData([]);
+        this.stores[2].loadData([]);
+        this.views
+        */    
+    
+        //this.el.focus();
+    },
+    onStoreLoad : function ()
+    {
+        Roo.log(arguments);
+    },
+    
+    // private
+    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 (view, sels, opts )
+    {
+        var ix = view.getSelectedIndexes();
+        
+        
+        if (opts.list > 1) {
+             
+            this.setFromData(ix.length ? view.store.getAt(ix[0]).data : {});
+            return;
+        }
+        
+        if (!ix.length) {
+            this.setFromData({});
+            this.stores[opts.list+1].loadData( [] );
+            return;
+        }
+        
+        var rec = view.store.getAt(ix[0]);
+        this.setFromData(rec.data);
+        
+        var lw = Math.floor(
+                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+        );
+        
+        this.stores[opts.list+1].loadData( typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn);
+        this.views[opts.list+1].getEl().setHeight( this.innerLists[0].getHeight());
+        this.views[opts.list+1].getEl().setStyle({ display : rec.data.cn.length ? 'block' : 'none' });
+        this.innerLists[opts.list+1].setHeight( this.innerLists[0].getHeight());
+        this.list.setWidth(lw * (opts.list + (rec.data.cn.length ? 2 : 1))); 
+    },
+    onDoubleClick : function()
+    {
+        this.collapse(); //??
+    },
+    
+     
+    
+    findRecord : function (prop,value)
+    {
+        return this.findRecordInStore(this.store, prop,value);
+    },
+    
+     // private
+    findRecordInStore : function(store, prop, value)
+    {
+        var cstore = new Roo.data.SimpleStore({
+            reader : this.store.reader,
+            data : [ ]
+        });
+        var _this = this;
+        var record  = false;
+        if(store.getCount() > 0){
+           store.each(function(r){
+                if(r.data[prop] == value){
+                    record = r;
+                    return false;
+                }
+                if (r.data.cn && r.data.cn.length) {
+                    cstore.loadData( r.data.cn);
+                    var cret = _this.findRecordInStore(cstore, prop, value);
+                    if (cret !== false) {
+                        record = cret;
+                        return false;
+                    }
+                }
+                
+                return true;
+            });
+        }
+        return record;
+    }
+    
 });/*
  * Based on:
  * Ext JS Library 1.1.1
index 1456121..0867b7b 100644 (file)
@@ -886,6 +886,25 @@ return true;}return false;},validateValue:function(A){return Roo.form.ComboBoxAr
 if(!this.el){var B=this.getAutoCreate();this.el=ct.createChild(B,A);}this.el.child('img').dom.setAttribute('src',Roo.BLANK_IMAGE_URL);this.el.child('div').dom.innerHTML=this.cb.renderer?this.cb.renderer(this.data):String.format('{0}',this.data[this.displayField]);
 this.el.child('div').dom.setAttribute('qtip',String.format('{0}',this.data[this.tipField]));this.el.child('img').on('click',this.remove,this);},remove:function(){if(this.cb.disabled){return;}if(false!==this.cb.fireEvent('beforeremove',this.cb,this)){this.cb.items.remove(this);
 this.el.child('img').un('click',this.remove,this);this.el.remove();this.cb.updateHiddenEl();this.cb.fireEvent('remove',this.cb,this);}}});
+// Roo/form/ComboNested.js
+Roo.form.ComboNested=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboNested : missing value for: "+e;
+}});};Roo.extend(Roo.form.ComboNested,Roo.form.ComboBox,{list:null,innerLists:null,views:null,stores:null,onRender:function(ct,A){Roo.form.ComboBox.superclass.onRender.call(this,ct,A);if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)}
+,'before',true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');}if(Roo.isGecko){this.el.dom.setAttribute('autocomplete','off');}var B='x-combo-list';this.list=new Roo.Layer({shadow:this.shadow,cls:[B,this.listClass].join(' '),constrain:false}
+);var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:B+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();
+}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:'&#160;',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:'<div class="'+A+'-item '+A+'-item-{cn:this.isEmpty}">{'+this.displayField+'}</div>',isEmpty:function(D,E){return D.length?'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.onStoreLoad,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.maxHeight?'auto':this.maxHeight);
+il.setHeight(h<this.maxHeight?'auto':this.maxHeight);mh=Math.max(el.getHeight(),mh);}},this);this.list.beginUpdate();this.list.setHeight(mh+this.list.getFrameWidth('tb')+this.assetHeight);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onLoad:function(a,b,c,d){if(!this.hasFocus){return;
+}if(this.store.getCount()>0){this.expand();this.restrictHeight();}else{this.onEmptyResults();}},onStoreLoad:function(){Roo.log(arguments);},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);this.stores[C.list+1].loadData(typeof(D.data.cn)=='undefined'?[]:D.data.cn);this.views[C.list+1].getEl().setHeight(this.innerLists[0].getHeight());
+this.views[C.list+1].getEl().setStyle({display:D.data.cn.length?'block':'none'});this.innerLists[C.list+1].setHeight(this.innerLists[0].getHeight());this.list.setWidth(lw*(C.list+(D.data.cn.length?2:1)));},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.loadData(r.data.cn);var G=E.findRecordInStore(D,B,C);
+if(G!==false){F=G;return false;}}return true;});}return F;}});
 // 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);