Roo/form/ComboBoxArray.js
[roojs1] / roojs-debug.js
index 644cac0..aa68db2 100644 (file)
@@ -21190,6 +21190,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
      */
@@ -31447,8 +31449,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){
@@ -33031,6 +33033,11 @@ Roo.extend(Roo.tree.TreeLoader, Roo.util.Observable, {
     * to be loaded.
     */
     /**
+    * @cfg {String} requestMethod either GET or POST
+    * defaults to POST (due to BC)
+    * to be loaded.
+    */
+    /**
     * @cfg {Object} baseParams (optional) An object containing properties which
     * specify HTTP parameters to be passed to each request for child nodes.
     */
@@ -38732,8 +38739,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;
@@ -38754,6 +38763,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);
+             
+        }
         
         
     },
@@ -38763,7 +38779,9 @@ 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 (typeof(v[this.valueField]) != 'string' || !v[this.valueField].length) {
+            return;
+        }
         var keys = v[this.valueField].split(',');
         var display = v[this.displayField].split(',');
         for (var i = 0 ; i < keys.length; i++) {
@@ -40797,7 +40815,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);
@@ -41982,7 +42000,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",
@@ -53282,7 +53300,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();
@@ -53299,7 +53321,12 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
 });
 
 Roo.apply(Roo.XComponent, {
-    
+    /**
+     * @property  hideProgress
+     * true to disable the building progress bar.. usefull on single page renders.
+     * @type Boolean
+     */
+    hideProgress : false,
     /**
      * @property  buildCompleted
      * True when the builder has completed building the interface.
@@ -53354,23 +53381,24 @@ Roo.apply(Roo.XComponent, {
      */
     register : function(obj) {
                
-               Roo.XComponent.event.fireEvent('register', obj);
-               switch(typeof(obj.disabled) ) {
-                       
-                       case 'undefined':
-                               break;
-                       
-                       case 'function':
-                               if ( obj.disabled() ) {
-                                       return;
-                               }
-                               break;
-                       default:
-                               if (obj.disabled) {
-                                       return;
-                               }
-                               break;
-               }
+        Roo.XComponent.event.fireEvent('register', obj);
+        switch(typeof(obj.disabled) ) {
+                
+            case 'undefined':
+                break;
+            
+            case 'function':
+                if ( obj.disabled() ) {
+                        return;
+                }
+                break;
+            
+            default:
+                if (obj.disabled) {
+                        return;
+                }
+                break;
+        }
                
         this.modules.push(obj);
          
@@ -53424,6 +53452,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);
@@ -53433,9 +53463,9 @@ Roo.apply(Roo.XComponent, {
             }
             
             if (!obj.parent) {
-                               Roo.debug && Roo.log("GOT top level module");
-                               Roo.debug && Roo.log(obj);
-                               obj.modules = new Roo.util.MixedCollection(false, 
+                Roo.debug && Roo.log("GOT top level module");
+                Roo.debug && Roo.log(obj);
+                obj.modules = new Roo.util.MixedCollection(false, 
                     function(o) { return o.order + '' }
                 );
                 this.topModule = obj;
@@ -53454,7 +53484,9 @@ Roo.apply(Roo.XComponent, {
                     function(o) { return o.order + '' }
                 );
             }
-            
+            if (obj.parent.disabled) {
+                obj.disabled = true;
+            }
             obj.parent.modules.add(obj);
         }, this);
     },
@@ -53477,24 +53509,26 @@ Roo.apply(Roo.XComponent, {
         // make a flat list in order of modules to build.
         var mods = this.topModule ? [ this.topModule ] : [];
                
-               // elmodules (is a list of DOM based modules )
-        Roo.each(this.elmodules,function(e) { mods.push(e) });
+       // elmodules (is a list of DOM based modules )
+        Roo.each(this.elmodules, function(e) {
+            mods.push(e)
+        });
 
         
         // add modules to their parents..
         var addMod = function(m) {
-                       Roo.debug && Roo.log("build Order: add: " + m.name);
+           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) {
                 m.finalize.name = m.name + " (clean up) ";
@@ -53532,23 +53566,27 @@ Roo.apply(Roo.XComponent, {
         
         var msg = "Building Interface...";
         // flash it up as modal - so we store the mask!?
-        Roo.MessageBox.show({ title: 'loading' });
-        Roo.MessageBox.show({
-           title: "Please wait...",
-           msg: msg,
-           width:450,
-           progress:true,
-           closable:false,
-           modal: false
-          
-        });
+        if (!this.hideProgress) {
+            Roo.MessageBox.show({ title: 'loading' });
+            Roo.MessageBox.show({
+               title: "Please wait...",
+               msg: msg,
+               width:450,
+               progress:true,
+               closable:false,
+               modal: false
+              
+            });
+        }
         var total = mods.length;
         
         var _this = this;
         var progressRun = function() {
             if (!mods.length) {
                 Roo.debug && Roo.log('hide?');
-                Roo.MessageBox.hide();
+                if (!this.hideProgress) {
+                    Roo.MessageBox.hide();
+                }
                 Roo.XComponent.event.fireEvent('buildcomplete', _this.topModule);
                 
                 // THE END...
@@ -53570,7 +53608,9 @@ Roo.apply(Roo.XComponent, {
                     " of " + total + 
                     (m.name ? (' - ' + m.name) : '');
                        Roo.debug && Roo.log(msg);
-            Roo.MessageBox.updateProgress(  (total  - mods.length)/total, msg  );
+            if (!this.hideProgress) { 
+                Roo.MessageBox.updateProgress(  (total  - mods.length)/total, msg  );
+            }
             
          
             // is the module disabled?
@@ -53627,6 +53667,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