X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/GroupingView.html diff --git a/docs/source/GroupingView.html b/docs/source/GroupingView.html index f85429fc..5d0d995b 100644 --- a/docs/source/GroupingView.html +++ b/docs/source/GroupingView.html @@ -1,11 +1,17 @@ - - - The source code - - - - -
/** + + + The source code + + + + +
/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+
/** * @class Ext.grid.GroupingView * @extends Ext.grid.GridView * Adds the ability for single level grouping to the grid. A {@link Ext.data.GroupingStore GroupingStore} @@ -140,6 +146,13 @@ var grid = new Ext.grid.GridPanel({ *
*/ groupTextTpl : '{text}', + +
/** + * @cfg {String} groupMode Indicates how to construct the group identifier. 'value' constructs the id using + * raw value, 'display' constructs the id using the rendered value. Defaults to 'value'. + */ + groupMode: 'value', +
/** * @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for * each column. @@ -316,7 +329,7 @@ var grid = new Ext.grid.GridPanel({ // private getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){ var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v); - if(g === ''){ + if(g === '' || g === ' '){ g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText; } return g; @@ -376,15 +389,14 @@ var grid = new Ext.grid.GridPanel({ return Ext.grid.GroupingView.superclass.doRender.apply( this, arguments); } - var gstyle = 'width:'+this.getTotalWidth()+';'; - - var gidPrefix = this.grid.getGridEl().id; - var cfg = this.cm.config[colIndex]; - var groupRenderer = cfg.groupRenderer || cfg.renderer; - var prefix = this.showGroupName ? - (cfg.groupName || cfg.header)+': ' : ''; + var gstyle = 'width:' + this.getTotalWidth() + ';', + gidPrefix = this.grid.getGridEl().id, + cfg = this.cm.config[colIndex], + groupRenderer = cfg.groupRenderer || cfg.renderer, + prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '', + groups = [], + curGroup, i, len, gid; - var groups = [], curGroup, i, len, gid; for(i = 0, len = rs.length; i < len; i++){ var rowIndex = startRow + i, r = rs[i], @@ -392,7 +404,7 @@ var grid = new Ext.grid.GridPanel({ g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds); if(!curGroup || curGroup.group != g){ - gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g); + gid = this.constructId(gvalue, gidPrefix, groupField, colIndex); // if state is defined use it, however state is in terms of expanded // so negate it, otherwise use the default. var isCollapsed = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed; @@ -432,13 +444,17 @@ var grid = new Ext.grid.GridPanel({ * @return {String} The group id */ getGroupId : function(value){ - var gidPrefix = this.grid.getGridEl().id; - var groupField = this.getGroupField(); - var colIndex = this.cm.findColumnIndex(groupField); - var cfg = this.cm.config[colIndex]; - var groupRenderer = cfg.groupRenderer || cfg.renderer; - var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds); - return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value); + var field = this.getGroupField(); + return this.constructId(value, this.grid.getGridEl().id, field, this.cm.findColumnIndex(field)); + }, + + // private + constructId : function(value, prefix, field, idx){ + var cfg = this.cm.config[idx], + groupRenderer = cfg.groupRenderer || cfg.renderer, + val = (this.groupMode == 'value') ? value : this.getGroup(value, {data:{}}, groupRenderer, 0, idx, this.ds); + + return prefix + '-gp-' + field + '-' + Ext.util.Format.htmlEncode(val); }, // private @@ -472,7 +488,7 @@ var grid = new Ext.grid.GridPanel({ if(!this.enableGrouping || !this.hasRows()){ return; } - var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px'; + var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px'; var gs = this.getGroups(); for(var i = 0, len = gs.length; i < len; i++){ gs[i].firstChild.style.width = tw; @@ -515,6 +531,6 @@ var grid = new Ext.grid.GridPanel({ } }); // private -Ext.grid.GroupingView.GROUP_ID = 1000;
- +Ext.grid.GroupingView.GROUP_ID = 1000; + \ No newline at end of file