/*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
* </code></pre>\r
*/\r
groupTextTpl : '{text}',\r
+ \r
+ /**\r
+ * @cfg {String} groupMode Indicates how to construct the group identifier. <tt>'value'</tt> constructs the id using\r
+ * raw value, <tt>'display'</tt> constructs the id using the rendered value. Defaults to <tt>'value'</tt>.\r
+ */\r
+ groupMode: 'value',\r
+ \r
/**\r
* @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for\r
* each column.\r
// private\r
getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){\r
var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);\r
- if(g === ''){\r
+ if(g === '' || g === ' '){\r
g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;\r
}\r
return g;\r
return Ext.grid.GroupingView.superclass.doRender.apply(\r
this, arguments);\r
}\r
- var gstyle = 'width:'+this.getTotalWidth()+';';\r
-\r
- var gidPrefix = this.grid.getGridEl().id;\r
- var cfg = this.cm.config[colIndex];\r
- var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
- var prefix = this.showGroupName ?\r
- (cfg.groupName || cfg.header)+': ' : '';\r
+ var gstyle = 'width:' + this.getTotalWidth() + ';',\r
+ gidPrefix = this.grid.getGridEl().id,\r
+ cfg = this.cm.config[colIndex],\r
+ groupRenderer = cfg.groupRenderer || cfg.renderer,\r
+ prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '',\r
+ groups = [],\r
+ curGroup, i, len, gid;\r
\r
- var groups = [], curGroup, i, len, gid;\r
for(i = 0, len = rs.length; i < len; i++){\r
var rowIndex = startRow + i,\r
r = rs[i],\r
\r
g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);\r
if(!curGroup || curGroup.group != g){\r
- gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);\r
+ gid = this.constructId(gvalue, gidPrefix, groupField, colIndex);\r
// if state is defined use it, however state is in terms of expanded\r
// so negate it, otherwise use the default.\r
var isCollapsed = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;\r
* @return {String} The group id\r
*/\r
getGroupId : function(value){\r
- var gidPrefix = this.grid.getGridEl().id;\r
- var groupField = this.getGroupField();\r
- var colIndex = this.cm.findColumnIndex(groupField);\r
- var cfg = this.cm.config[colIndex];\r
- var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
- var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);\r
- return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);\r
+ var field = this.getGroupField();\r
+ return this.constructId(value, this.grid.getGridEl().id, field, this.cm.findColumnIndex(field));\r
+ },\r
+ \r
+ // private\r
+ constructId : function(value, prefix, field, idx){\r
+ var cfg = this.cm.config[idx],\r
+ groupRenderer = cfg.groupRenderer || cfg.renderer,\r
+ val = (this.groupMode == 'value') ? value : this.getGroup(value, {data:{}}, groupRenderer, 0, idx, this.ds);\r
+ \r
+ return prefix + '-gp-' + field + '-' + Ext.util.Format.htmlEncode(val);\r
},\r
\r
// private\r
if(!this.enableGrouping || !this.hasRows()){\r
return;\r
}\r
- var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';\r
+ var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px';\r
var gs = this.getGroups();\r
for(var i = 0, len = gs.length; i < len; i++){\r
gs[i].firstChild.style.width = tw;\r