Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / source / GroupSummary.html
index 29f6003..750d9ad 100644 (file)
@@ -1,10 +1,10 @@
-<html>\r
-<head>\r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
+<html>
+<head>
+  <title>The source code</title>
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body  onload="prettyPrint();">
     <pre class="prettyprint lang-js">Ext.ns('Ext.ux.grid');\r
 \r
 <div id="cls-Ext.ux.grid.GroupSummary"></div>/**\r
@@ -33,10 +33,7 @@ summaryRenderer: function(v, params, data){
     },\r
     init : function(grid){\r
         this.grid = grid;\r
-        this.cm = grid.getColumnModel();\r
-        this.view = grid.getView();\r
-\r
-        var v = this.view;\r
+        var v = this.view = grid.getView();\r
         v.doGroupEnd = this.doGroupEnd.createDelegate(this);\r
 \r
         v.afterMethod('onColumnWidthUpdated', this.doWidth, this);\r
@@ -83,9 +80,8 @@ summaryRenderer: function(v, params, data){
 \r
     renderSummary : function(o, cs){\r
         cs = cs || this.view.getColumnData();\r
-        var cfg = this.cm.config;\r
-\r
-        var buf = [], c, p = {}, cf, last = cs.length-1;\r
+        var cfg = this.grid.getColumnModel().config,\r
+            buf = [], c, p = {}, cf, last = cs.length-1;\r
         for(var i = 0, len = cs.length; i < len; i++){\r
             c = cs[i];\r
             cf = cfg[i];\r
@@ -113,7 +109,7 @@ summaryRenderer: function(v, params, data){
      * @param {Object} cs\r
      */\r
     calculate : function(rs, cs){\r
-        var data = {}, r, c, cfg = this.cm.config, cf;\r
+        var data = {}, r, c, cfg = this.grid.getColumnModel().config, cf;\r
         for(var j = 0, jlen = rs.length; j < jlen; j++){\r
             r = rs[j];\r
             for(var i = 0, len = cs.length; i < len; i++){\r
@@ -181,21 +177,21 @@ summaryRenderer: function(v, params, data){
     },\r
 \r
     refreshSummaryById : function(gid){\r
-        var g = document.getElementById(gid);\r
+        var g = Ext.getDom(gid);\r
         if(!g){\r
             return false;\r
         }\r
         var rs = [];\r
-        this.grid.store.each(function(r){\r
+        this.grid.getStore().each(function(r){\r
             if(r._groupId == gid){\r
                 rs[rs.length] = r;\r
             }\r
         });\r
-        var cs = this.view.getColumnData();\r
-        var data = this.calculate(rs, cs);\r
-        var markup = this.renderSummary({data: data}, cs);\r
-\r
-        var existing = this.getSummaryNode(gid);\r
+        var cs = this.view.getColumnData(),\r
+            data = this.calculate(rs, cs),\r
+            markup = this.renderSummary({data: data}, cs),\r
+            existing = this.getSummaryNode(gid);\r
+            \r
         if(existing){\r
             g.removeChild(existing);\r
         }\r
@@ -225,8 +221,8 @@ grid.on('afteredit', function(){
      * @param {String} msg Text to use as innerHTML for the summary row.\r
      */\r
     showSummaryMsg : function(groupValue, msg){\r
-        var gid = this.view.getGroupId(groupValue);\r
-        var node = this.getSummaryNode(gid);\r
+        var gid = this.view.getGroupId(groupValue),\r
+             node = this.getSummaryNode(gid);\r
         if(node){\r
             node.innerHTML = '<div class="x-grid3-summary-msg">' + msg + '</div>';\r
         }\r
@@ -318,9 +314,9 @@ Ext.ux.grid.HybridSummary = Ext.extend(Ext.ux.grid.GroupSummary, {
      * @param {Object} cs\r
      */\r
     calculate : function(rs, cs){\r
-        var gcol = this.view.getGroupField();\r
-        var gvalue = rs[0].data[gcol];\r
-        var gdata = this.getSummaryData(gvalue);\r
+        var gcol = this.view.getGroupField(),\r
+            gvalue = rs[0].data[gcol],\r
+            gdata = this.getSummaryData(gvalue);\r
         return gdata || Ext.ux.grid.HybridSummary.superclass.calculate.call(this, rs, cs);\r
     },\r
 \r
@@ -342,7 +338,7 @@ grid.on('afteredit', function(){
      * @param {Boolean} skipRefresh (Optional) Defaults to false\r
      */\r
     updateSummaryData : function(groupValue, data, skipRefresh){\r
-        var json = this.grid.store.reader.jsonData;\r
+        var json = this.grid.getStore().reader.jsonData;\r
         if(!json.summaryData){\r
             json.summaryData = {};\r
         }\r
@@ -358,7 +354,7 @@ grid.on('afteredit', function(){
      * @return {Object} summaryData\r
      */\r
     getSummaryData : function(groupValue){\r
-        var json = this.grid.store.reader.jsonData;\r
+        var json = this.grid.getStore().reader.jsonData;\r
         if(json && json.summaryData){\r
             return json.summaryData[groupValue];\r
         }\r
@@ -368,6 +364,6 @@ grid.on('afteredit', function(){
 \r
 //backwards compat\r
 Ext.grid.HybridSummary = Ext.ux.grid.HybridSummary;\r
-</pre>    \r
-</body>\r
+</pre>
+</body>
 </html>
\ No newline at end of file