* @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
*/\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
* 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
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.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