Roo/bootstrap/Table.js
[roojs1] / Roo / bootstrap / Table.js
index e7ad183..c83f778 100644 (file)
@@ -80,6 +80,7 @@ Currently the Table  uses multiple headers to try and handle XL / Medium etc...
  *                also adds table-responsive (see bootstrap docs for details)
  * @cfg {Boolean} loadMask (true|false) default false
  * @cfg {Boolean} footerShow (true|false) generate tfoot, default true
+ * @cfg {Boolean} summaryFooterShow (true|false) generate tfoot for summary, default false
  * @cfg {Boolean} headerShow (true|false) generate thead, default true
  * @cfg {Boolean} rowSelection (true|false) default false
  * @cfg {Boolean} cellSelection (true|false) default false
@@ -88,6 +89,7 @@ Currently the Table  uses multiple headers to try and handle XL / Medium etc...
  * @cfg {Boolean} lazyLoad  auto load data while scrolling to the end (default false)
  * @cfg {Boolean} auto_hide_footer  auto hide footer if only one page (default false)
  * @cfg {Boolean} enableColumnResize default true if columns can be resized = needs scrollBody to be set to work (drag/drop)
+ * @cfg {Boolean} disableAutoSize disable autoSize() and initCSS()
  *
  * 
  * @cfg {Number} minColumnWidth default 50 pixels minimum column width 
@@ -263,8 +265,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     store : false,
     loadMask : false,
     footerShow : true,
+    summaryFooterShow : false,
     headerShow : true,
     enableColumnResize: true,
+    disableAutoSize: false,
   
     rowSelection : false,
     cellSelection : false,
@@ -340,6 +344,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             if(this.footerShow){
                 cfg.cn.push(this.renderFooter());
             }
+
+            if(!this.footerShow && this.summaryFooterShow) {
+                cfg.cn.push(this.renderSummaryFooter());
+            }
             // where does this come from?
             //cfg.cls+=  ' TableGrid';
         }
@@ -426,7 +434,9 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     
     initCSS : function()
     {
-        
+        if(this.disableAutoSize) {
+            return;
+        }
         
         var cm = this.cm, styles = [];
         this.CSS.removeStyleSheet(this.id + '-cssrules');
@@ -897,6 +907,33 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         return footer;
     },
+
+    renderSummaryFooter : function()
+    {
+        var footer = {
+            tag: 'tfoot',
+            cn : []
+        };
+
+        var cm = this.cm;
+        
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            
+            var config = cm.config[i];
+            
+            var c = {
+                tag: 'td',
+                cls : 'x-fcol-' + i,
+                style : '',
+                
+                html: config.footer
+            };
+            
+            footer.cn.push(c)
+        }
+        
+        return footer;
+    },
     
     
     
@@ -1430,6 +1467,9 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
      */
     autoSize : function()
     {
+        if(this.disableAutoSize) {
+            return;
+        }
         //var ctr = Roo.get(this.container.dom.parentElement);
         var ctr = Roo.get(this.el.dom);