fix docs
[roojs1] / Roo / bootstrap / ButtonGroup.js
index 15e63d7..4c50892 100644 (file)
@@ -1,9 +1,27 @@
 /*
  * - LGPL
  *
- * page contgainer.
+ * button group
  * 
- */ 
+ */
+
+
+/**
+ * @class Roo.bootstrap.ButtonGroup
+ * @extends Roo.bootstrap.Component
+ * Bootstrap ButtonGroup class
+ * @cfg {String} size lg | sm | xs (default empty normal)
+ * @cfg {String} align vertical | justified  (default none)
+ * @cfg {String} direction up | down (default down)
+ * @cfg {Boolean} toolbar false | true
+ * @cfg {Boolean} btn true | false
+ * 
+ * 
+ * @constructor
+ * Create a new Input
+ * @param {Object} config The config object
+ */
+
 Roo.bootstrap.ButtonGroup = function(config){
     Roo.bootstrap.ButtonGroup.superclass.constructor.call(this, config);
 };
@@ -12,24 +30,32 @@ Roo.extend(Roo.bootstrap.ButtonGroup, Roo.bootstrap.Component,  {
     
     size: '',
     align: '',
-    dropdirection: '',
-    
-    autoCreate : {
-        cls: 'btn-group',
-        html : null
-    },
+    direction: '',
+    toolbar: false,
+    btn: true,
 
     getAutoCreate : function(){
-        
-        var cfg = Roo.apply({}, Roo.bootstrap.ButtonGroup.superclass.getAutoCreate.call(this));
+        var cfg = {
+            cls: 'btn-group',
+            html : null
+        };
         
         cfg.html = this.html || cfg.html;
         
+        if (this.toolbar) {
+            cfg = {
+                cls: 'btn-toolbar',
+                html: null
+            };
+            
+            return cfg;
+        }
+        
         if (['vertical','justified'].indexOf(this.align)!==-1) {
             cfg.cls = 'btn-group-' + this.align;
             
             if (this.align == 'justified') {
-                console.log(this.items)
+                console.log(this.items);
             }
         }
         
@@ -37,11 +63,22 @@ Roo.extend(Roo.bootstrap.ButtonGroup, Roo.bootstrap.Component,  {
             cfg.cls += ' btn-group-' + this.size;
         }
         
-        if (['dropup'].indexOf(this.dropdirection)) {
-            cfg.cls += ' dropup';
+        if (this.direction == 'up') {
+            cfg.cls += ' dropup' ;
         }
         
         return cfg;
+    },
+    /**
+     * Add a button to the group (similar to NavItem API.)
+     */
+    addItem : function(cfg)
+    {
+        var cn = new Roo.bootstrap.Button(cfg);
+        //this.register(cn);
+        cn.parentId = this.id;
+        cn.onRender(this.el, null);
+        return cn;
     }
    
 });