Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / source / GroupingStore.html
index aa0f925..1162162 100644 (file)
@@ -1,17 +1,12 @@
-<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 JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.data.GroupingStore"></div>/**\r
+<html>\r
+<head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \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
+    <pre class="prettyprint lang-js"><div id="cls-Ext.data.GroupingStore"></div>/**\r
  * @class Ext.data.GroupingStore\r
  * @extends Ext.data.Store\r
  * A specialized store implementation that provides for grouping records by one of the available fields. This\r
  * @class Ext.data.GroupingStore\r
  * @extends Ext.data.Store\r
  * A specialized store implementation that provides for grouping records by one of the available fields. This\r
  * @xtype groupingstore\r
  */\r
 Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {\r
  * @xtype groupingstore\r
  */\r
 Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {\r
-    \r
+\r
     //inherit docs\r
     constructor: function(config){\r
         Ext.data.GroupingStore.superclass.constructor.call(this, config);\r
         this.applyGroupField();\r
     },\r
     //inherit docs\r
     constructor: function(config){\r
         Ext.data.GroupingStore.superclass.constructor.call(this, config);\r
         this.applyGroupField();\r
     },\r
-    \r
+\r
     <div id="cfg-Ext.data.GroupingStore-groupField"></div>/**\r
      * @cfg {String} groupField\r
      * The field name by which to sort the store's data (defaults to '').\r
     <div id="cfg-Ext.data.GroupingStore-groupField"></div>/**\r
      * @cfg {String} groupField\r
      * The field name by which to sort the store's data (defaults to '').\r
@@ -49,21 +44,25 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
      */\r
     groupOnSort:false,\r
 \r
      */\r
     groupOnSort:false,\r
 \r
-       groupDir : 'ASC',\r
-       \r
+    groupDir : 'ASC',\r
+\r
     <div id="method-Ext.data.GroupingStore-clearGrouping"></div>/**\r
      * Clears any existing grouping and refreshes the data using the default sort.\r
      */\r
     clearGrouping : function(){\r
         this.groupField = false;\r
     <div id="method-Ext.data.GroupingStore-clearGrouping"></div>/**\r
      * Clears any existing grouping and refreshes the data using the default sort.\r
      */\r
     clearGrouping : function(){\r
         this.groupField = false;\r
+\r
         if(this.remoteGroup){\r
             if(this.baseParams){\r
                 delete this.baseParams.groupBy;\r
         if(this.remoteGroup){\r
             if(this.baseParams){\r
                 delete this.baseParams.groupBy;\r
+                delete this.baseParams.groupDir;\r
             }\r
             var lo = this.lastOptions;\r
             if(lo && lo.params){\r
                 delete lo.params.groupBy;\r
             }\r
             var lo = this.lastOptions;\r
             if(lo && lo.params){\r
                 delete lo.params.groupBy;\r
+                delete lo.params.groupDir;\r
             }\r
             }\r
+\r
             this.reload();\r
         }else{\r
             this.applySort();\r
             this.reload();\r
         }else{\r
             this.applySort();\r
@@ -78,12 +77,12 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
      * in is the same as the current grouping field, false to skip grouping on the same field (defaults to false)\r
      */\r
     groupBy : function(field, forceRegroup, direction){\r
      * in is the same as the current grouping field, false to skip grouping on the same field (defaults to false)\r
      */\r
     groupBy : function(field, forceRegroup, direction){\r
-               direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;\r
+        direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;\r
         if(this.groupField == field && this.groupDir == direction && !forceRegroup){\r
             return; // already grouped by this field\r
         }\r
         this.groupField = field;\r
         if(this.groupField == field && this.groupDir == direction && !forceRegroup){\r
             return; // already grouped by this field\r
         }\r
         this.groupField = field;\r
-               this.groupDir = direction;\r
+        this.groupDir = direction;\r
         this.applyGroupField();\r
         if(this.groupOnSort){\r
             this.sort(field, direction);\r
         this.applyGroupField();\r
         if(this.groupOnSort){\r
             this.sort(field, direction);\r
@@ -93,7 +92,7 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
             this.reload();\r
         }else{\r
             var si = this.sortInfo || {};\r
             this.reload();\r
         }else{\r
             var si = this.sortInfo || {};\r
-            if(si.field != field || si.direction != direction){\r
+            if(forceRegroup || si.field != field || si.direction != direction){\r
                 this.applySort();\r
             }else{\r
                 this.sortData(field, direction);\r
                 this.applySort();\r
             }else{\r
                 this.sortData(field, direction);\r
@@ -101,15 +100,25 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
             this.fireEvent('datachanged', this);\r
         }\r
     },\r
             this.fireEvent('datachanged', this);\r
         }\r
     },\r
-    \r
+\r
     // private\r
     applyGroupField: function(){\r
         if(this.remoteGroup){\r
             if(!this.baseParams){\r
                 this.baseParams = {};\r
             }\r
     // private\r
     applyGroupField: function(){\r
         if(this.remoteGroup){\r
             if(!this.baseParams){\r
                 this.baseParams = {};\r
             }\r
-            this.baseParams.groupBy = this.groupField;\r
-            this.baseParams.groupDir = this.groupDir;\r
+            Ext.apply(this.baseParams, {\r
+                groupBy : this.groupField,\r
+                groupDir : this.groupDir\r
+            });\r
+\r
+            var lo = this.lastOptions;\r
+            if(lo && lo.params){\r
+                Ext.apply(lo.params, {\r
+                    groupBy : this.groupField,\r
+                    groupDir : this.groupDir\r
+                });\r
+            }\r
         }\r
     },\r
 \r
         }\r
     },\r
 \r
@@ -143,6 +152,6 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
                (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;\r
     }\r
 });\r
                (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;\r
     }\r
 });\r
-Ext.reg('groupingstore', Ext.data.GroupingStore);</pre>
-</body>
+Ext.reg('groupingstore', Ext.data.GroupingStore);</pre>    \r
+</body>\r
 </html>
\ No newline at end of file
 </html>
\ No newline at end of file