Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / src / grid / feature / AbstractSummary.js
index d083f6b..7264afc 100644 (file)
@@ -1,9 +1,22 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact:  http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
 /**
- * A small abstract class that contains the shared behaviour for any summary
- * calculations to be used in the grid.
  * @class Ext.grid.feature.AbstractSummary
  * @extends Ext.grid.feature.Feature
- * @ignore
+ * A small abstract class that contains the shared behaviour for any summary
+ * calculations to be used in the grid.
  */
 Ext.define('Ext.grid.feature.AbstractSummary', {
     
@@ -25,7 +38,7 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
     
     /**
      * Toggle whether or not to show the summary row.
-     * @param {Boolan} visible True to show the summary row
+     * @param {Boolean} visible True to show the summary row
      */
     toggleSummaryRow: function(visible){
         this.showSummaryRow = !!visible;
@@ -53,9 +66,10 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
      * @return {String} The value of the summary row
      */
     printSummaryRow: function(index){
-        var inner = this.view.getTableChunker().metaRowTpl.join('');
+        var inner = this.view.getTableChunker().metaRowTpl.join(''),
+            prefix = Ext.baseCSSPrefix;
         
-        inner = inner.replace('x-grid-row', 'x-grid-row-summary');
+        inner = inner.replace(prefix + 'grid-row', prefix + 'grid-row-summary');
         inner = inner.replace('{{id}}', '{gridSummaryValue}');
         inner = inner.replace(this.nestedIdRe, '{id$1}');  
         inner = inner.replace('{[this.embedRowCls()]}', '{rowCls}');
@@ -75,13 +89,18 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
      * @param {Object} data The current data
      * @return {String} The value to be rendered
      */
-    getColumnValue: function(column, data){
-        var comp = Ext.getCmp(column.id),
-            value = data[column.dataIndex],
-            renderer = comp.summaryRenderer || comp.renderer;
-            
+    getColumnValue: function(column, summaryData){
+        var comp     = Ext.getCmp(column.id),
+            value    = summaryData[column.id],
+            renderer = comp.summaryRenderer;
+
         if (renderer) {
-            value = renderer.call(comp.scope || this, value, data, column.dataIndex);
+            value = renderer.call(
+                comp.scope || this,
+                value,
+                summaryData,
+                column.dataIndex
+            );
         }
         return value;
     },
@@ -94,7 +113,7 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
      * be passed to the stores aggregate function.
      * @param {String} field The field to aggregate on
      * @param {Boolean} group True to aggregate in grouped mode 
-     * @return {Mixed} See the return type for the store functions.
+     * @return {Number/String/Object} See the return type for the store functions.
      */
     getSummary: function(store, type, field, group){
         if (type) {
@@ -121,3 +140,4 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
     }
     
 });
+