Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / GroupingSummary.html
index 02bf8ae..4bd3348 100644 (file)
@@ -3,8 +3,8 @@
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>The source code</title>
-  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
-  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
   <style type="text/css">
     .highlight { display: block; background-color: #ddd; }
   </style>
   <pre class="prettyprint lang-js"><span id='Ext-grid-feature-GroupingSummary'>/**
 </span> * @class Ext.grid.feature.GroupingSummary
  * @extends Ext.grid.feature.Grouping
- * 
+ *
  * This feature adds an aggregate summary row at the bottom of each group that is provided
- * by the {@link Ext.grid.feature.Grouping} feature. There are 2 aspects to the summary:
- * 
+ * by the {@link Ext.grid.feature.Grouping} feature. There are two aspects to the summary:
+ *
  * ## Calculation
- * 
+ *
  * The summary value needs to be calculated for each column in the grid. This is controlled
  * by the summaryType option specified on the column. There are several built in summary types,
  * which can be specified as a string on the column configuration. These call underlying methods
@@ -37,9 +37,9 @@
  *
  * Alternatively, the summaryType can be a function definition. If this is the case,
  * the function is called with an array of records to calculate the summary value.
- * 
+ *
  * ## Rendering
- * 
+ *
  * Similar to a column, the summary also supports a summaryRenderer function. This
  * summaryRenderer is called before displaying a value. The function is optional, if
  * not specified the default calculated value is shown. The summaryRenderer is called with:
  *  - value {Object} - The calculated value.
  *  - summaryData {Object} - Contains all raw summary values for the row.
  *  - field {String} - The name of the field we are calculating
- * 
+ *
  * ## Example Usage
  *
+ *     @example
  *     Ext.define('TestResult', {
  *         extend: 'Ext.data.Model',
  *         fields: ['student', 'subject', {
@@ -57,7 +58,7 @@
  *             type: 'int'
  *         }]
  *     });
- *     
+ *
  *     Ext.create('Ext.grid.Panel', {
  *         width: 200,
  *         height: 240,
@@ -92,7 +93,7 @@
  *             text: 'Name',
  *             summaryType: 'count',
  *             summaryRenderer: function(value){
- *                 return Ext.String.format('{0} student{1}', value, value !== 1 ? 's' : ''); 
+ *                 return Ext.String.format('{0} student{1}', value, value !== 1 ? 's' : '');
  *             }
  *         }, {
  *             dataIndex: 'mark',
  *     });
  */
 Ext.define('Ext.grid.feature.GroupingSummary', {
-    
+
     /* Begin Definitions */
-    
+
     extend: 'Ext.grid.feature.Grouping',
-    
+
     alias: 'feature.groupingsummary',
-    
+
     mixins: {
         summary: 'Ext.grid.feature.AbstractSummary'
     },
-    
+
     /* End Definitions */
 
-     
+
 <span id='Ext-grid-feature-GroupingSummary-method-getFeatureTpl'>   /**
 </span>    * Modifies the row template to include the summary row.
     * @private
@@ -123,7 +124,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
     */
    getFeatureTpl: function() {
         var tpl = this.callParent(arguments);
-            
+
         if (this.showSummaryRow) {
             // lop off the end &lt;/tpl&gt; so we can attach it
             tpl = tpl.replace('&lt;/tpl&gt;', '');
@@ -131,7 +132,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
         }
         return tpl;
     },
-    
+
 <span id='Ext-grid-feature-GroupingSummary-method-getFragmentTpl'>    /**
 </span>     * Gets any fragments needed for the template.
      * @private
@@ -140,7 +141,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
     getFragmentTpl: function() {
         var me = this,
             fragments = me.callParent();
-            
+
         Ext.apply(fragments, me.getSummaryFragments());
         if (me.showSummaryRow) {
             // this gets called before render, so we'll setup the data here.
@@ -149,7 +150,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
         }
         return fragments;
     },
-    
+
 <span id='Ext-grid-feature-GroupingSummary-method-getPrintData'>    /**
 </span>     * Gets the data for printing a template row
      * @private
@@ -165,7 +166,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
             name = me.summaryGroups[index - 1].name,
             active = me.summaryData[name],
             column;
-            
+
         for (; i &lt; length; ++i) {
             column = columns[i];
             column.gridSummaryValue = this.getColumnValue(column, active);
@@ -173,7 +174,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
         }
         return data;
     },
-    
+
 <span id='Ext-grid-feature-GroupingSummary-method-generateSummaryData'>    /**
 </span>     * Generates all of the summary data to be used when processing the template
      * @private
@@ -195,16 +196,15 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
             root,
             key,
             comp;
-            
+
         for (i = 0, length = groups.length; i &lt; length; ++i) {
             data[groups[i].name] = {};
         }
-        
-<span id='Ext-grid-feature-GroupingSummary-cfg-remoteRoot'>    /**
-</span>     * @cfg {String} remoteRoot.  The name of the property
-     * which contains the Array of summary objects.  Defaults to &lt;tt&gt;undefined&lt;/tt&gt;.
-     * It allows to use server-side calculated summaries.
-     */
+
+<span id='Ext-grid-feature-GroupingSummary-cfg-remoteRoot'>        /**
+</span>         * @cfg {String} [remoteRoot=undefined]  The name of the property which contains the Array of
+         * summary objects. It allows to use server-side calculated summaries.
+         */
         if (me.remoteRoot &amp;&amp; reader.rawData) {
             // reset reader root and rebuild extractors to extract summaries data
             root = reader.root;
@@ -217,21 +217,21 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
             reader.root = root;
             reader.buildExtractors(true);
         }
-        
+
         for (i = 0, length = columns.length; i &lt; length; ++i) {
             comp = Ext.getCmp(columns[i].id);
             fieldData = me.getSummary(store, comp.summaryType, comp.dataIndex, true);
-            
+
             for (key in fieldData) {
                 if (fieldData.hasOwnProperty(key)) {
                     data[key][comp.id] = fieldData[key];
                 }
             }
-            
+
             for (key in remoteData) {
                 if (remoteData.hasOwnProperty(key)) {
                     remote = remoteData[key][comp.dataIndex];
-                    if (remote !== undefined) {
+                    if (remote !== undefined &amp;&amp; data[key] !== undefined) {
                         data[key][comp.id] = remote;
                     }
                 }