Roo/form/ComboBoxArray.js
[roojs1] / roojs-ui-debug.js
index 387085d..2626cf7 100644 (file)
@@ -6671,6 +6671,8 @@ Roo.data.Node = function(attributes){
         this.id = Roo.id(null, "ynode-");
         this.attributes.id = this.id;
     }
+     
+    
     /**
      * All child nodes of this node. @type Array
      */
@@ -16928,8 +16930,8 @@ Roo.extend(Roo.tree.TreePanel, Roo.data.Tree, {
         }
         this.getSelectionModel().init(this);
         if (!this.root) {
-            console.log("ROOT not set in tree");
-            return;
+            Roo.log("ROOT not set in tree");
+            return this;
         }
         this.root.render();
         if(!this.rootVisible){
@@ -24218,8 +24220,10 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField,
     {
          
         this.reset();
-
-        if (this.store.isLocal) {
+        
+        
+        
+        if (this.store.isLocal && (typeof(v) == 'string')) {
             // then we can use the store to find the values..
             // comma seperated at present.. this needs to allow JSON based encoding..
             this.hiddenEl.value  = v;
@@ -24240,6 +24244,13 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField,
                 
             
         }
+        if (typeof(v) == 'object') {
+            // then let's assume it's an array of objects..
+            Roo.each(v, function(l) {
+                this.addItem(l);
+            }, this);
+             
+        }
         
         
     },
@@ -24249,7 +24260,7 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField,
         this.reset();
         this.el.dom.value = v[this.displayField];
         this.hiddenEl.dom.value = v[this.valueField];
-        if (!v[this.valueField].length) {
+        if (typeof(v[this.valueField]) != 'string' || !v[this.valueField].length) {
             return;
         }
         var keys = v[this.valueField].split(',');
@@ -26285,7 +26296,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,  {
         
         if (this.btns) {
             for(var i =0; i< this.btns.length;i++) {
-                var b = this.btns[i];
+                var b = Roo.factory(this.btns[i],Roo.form);
                 b.cls =  'x-edit-none';
                 b.scope = editor;
                 tb.add(b);
@@ -27470,7 +27481,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
                 (typeof(action.result) != 'undefined')  &&
                 (typeof(action.result.errors) != 'undefined')  &&
                 (typeof(action.result.errors.needs_confirm) != 'undefined')
-           ){
+          ){
                 var _t = this;
                 Roo.MessageBox.confirm(
                     "Change requires confirmation",
@@ -38770,7 +38781,11 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
             }
         }
         
-               
+               if (!this.parent.el) {
+                       // probably an old style ctor, which has been disabled.
+                       return;
+                       
+               }
                // The 'tree' method is  '_tree now' 
             
         var tree = this._tree ? this._tree() : this.tree();
@@ -38918,6 +38933,8 @@ Roo.apply(Roo.XComponent, {
         var _t = this;
         Roo.each(this.modules , function (obj)
         {
+            Roo.XComponent.event.fireEvent('beforebuild', obj);
+            
             var opar = obj.parent;
             try { 
                 obj.parent = this.toObject(opar);
@@ -38948,7 +38965,9 @@ Roo.apply(Roo.XComponent, {
                     function(o) { return o.order + '' }
                 );
             }
-            
+            if (obj.parent.disabled) {
+                obj.disabled = true;
+            }
             obj.parent.modules.add(obj);
         }, this);
     },
@@ -38981,15 +39000,15 @@ Roo.apply(Roo.XComponent, {
         var addMod = function(m) {
            Roo.debug && Roo.log("build Order: add: " + m.name);
             
-            mods.push(m);
-            if (m.modules) {
-                Roo.debug && Roo.log("build Order: " + m.modules.length + " child modules");
-                m.modules.keySort('ASC',  cmp );
-               Roo.debug && Roo.log("build Order: " + m.modules.length + " child modules (after sort)");
+        mods.push(m);
+        if (m.modules && !m.disabled) {
+            Roo.debug && Roo.log("build Order: " + m.modules.length + " child modules");
+            m.modules.keySort('ASC',  cmp );
+            Roo.debug && Roo.log("build Order: " + m.modules.length + " child modules (after sort)");
 
-                m.modules.each(addMod);
-            } else {
-               Roo.debug && Roo.log("build Order: no child modules");
+            m.modules.each(addMod);
+        } else {
+            Roo.debug && Roo.log("build Order: no child modules");
            }
             // not sure if this is used any more..
             if (m.finalize) {
@@ -39129,6 +39148,14 @@ Roo.XComponent.event = new Roo.util.Observable({
                         * 
                         */
                        'register' : true,
+            /**
+                        * @event beforebuild
+                        * Fires before each Component is built
+                        * can be used to apply permissions.
+                        * @param {Roo.XComponent} c the component being registerd.
+                        * 
+                        */
+                       'beforebuild' : true,
                        /**
                         * @event buildcomplete
                         * Fires on the top level element when all elements have been built