Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / source / GroupingStore.html
index 98fc34f..1162162 100644 (file)
@@ -1,5 +1,6 @@
 <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
  * @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
-    \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
@@ -43,21 +44,25 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
      */\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
+\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
+                delete lo.params.groupDir;\r
             }\r
+\r
             this.reload();\r
         }else{\r
             this.applySort();\r
@@ -72,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
-               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
-               this.groupDir = direction;\r
+        this.groupDir = direction;\r
         this.applyGroupField();\r
         if(this.groupOnSort){\r
             this.sort(field, direction);\r
@@ -87,7 +92,7 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
             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
@@ -95,15 +100,25 @@ Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
             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
-            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