X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..92c2b89db26be16707f4a805d3303ab2531006e1:/docs/source/GroupingView.html?ds=inline diff --git a/docs/source/GroupingView.html b/docs/source/GroupingView.html index fe1ba17e..3915285b 100644 --- a/docs/source/GroupingView.html +++ b/docs/source/GroupingView.html @@ -192,11 +192,11 @@ var grid = new Ext.grid.GridPanel({ // private onAdd : function(){ - if(this.enableGrouping && !this.ignoreAdd){ + if(this.canGroup() && !this.ignoreAdd){ var ss = this.getScrollState(); this.refresh(); this.restoreScroll(ss); - }else if(!this.enableGrouping){ + }else if(!this.canGroup()){ Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments); } }, @@ -230,7 +230,7 @@ var grid = new Ext.grid.GridPanel({ } if((item = items.get('showGroups'))){ item.setDisabled(disabled); - item.setChecked(this.enableGrouping, true); + item.setChecked(this.enableGrouping, true); } }, @@ -251,7 +251,7 @@ var grid = new Ext.grid.GridPanel({ this.hmenu.add({ itemId:'showGroups', text: this.showGroupsText, - checked: true, + checked: true, checkHandler: this.onShowGroupsClick, scope: this }); @@ -279,10 +279,11 @@ var grid = new Ext.grid.GridPanel({ // private onGroupByClick : function(){ - this.enableGrouping = true; + this.enableGrouping = true; this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex)); + this.grid.fireEvent('groupchange', this, this.grid.store.getGroupState()); this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups - this.refresh(); + this.refresh(); }, // private @@ -292,6 +293,7 @@ var grid = new Ext.grid.GridPanel({ this.onGroupByClick(); }else{ this.grid.store.clearGrouping(); + this.grid.fireEvent('groupchange', this, null); } }, @@ -301,7 +303,7 @@ var grid = new Ext.grid.GridPanel({ * @param {Boolean} expanded (optional) */ toggleRowIndex : function(rowIndex, expanded){ - if(!this.enableGrouping){ + if(!this.canGroup()){ return; } var row = this.getRow(rowIndex); @@ -375,6 +377,9 @@ var grid = new Ext.grid.GridPanel({ // private afterRender : function(){ + if(!this.ds || !this.cm){ + return; + } Ext.grid.GroupingView.superclass.afterRender.call(this); if(this.grid.deferRowRender){ this.updateGroupWidths(); @@ -413,17 +418,16 @@ var grid = new Ext.grid.GridPanel({ if(rs.length < 1){ return ''; } - var groupField = this.getGroupField(), - colIndex = this.cm.findColumnIndex(groupField), - g; - - this.enableGrouping = (this.enableGrouping === false) ? false : !!groupField; - if(!this.enableGrouping || this.isUpdating){ + if(!this.canGroup() || this.isUpdating){ return Ext.grid.GroupingView.superclass.doRender.apply( this, arguments); } - var gstyle = 'width:' + this.getTotalWidth() + ';', + + var groupField = this.getGroupField(), + colIndex = this.cm.findColumnIndex(groupField), + g, + gstyle = 'width:' + this.getTotalWidth() + ';', cfg = this.cm.config[colIndex], groupRenderer = cfg.groupRenderer || cfg.renderer, prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '', @@ -489,6 +493,11 @@ var grid = new Ext.grid.GridPanel({ return this.getPrefix(field) + Ext.util.Format.htmlEncode(val); }, + // private + canGroup : function(){ + return this.enableGrouping && !!this.getGroupField(); + }, + // private getPrefix: function(field){ return this.grid.getGridEl().id + '-gp-' + field + '-'; @@ -506,7 +515,7 @@ var grid = new Ext.grid.GridPanel({ // private getRows : function(){ - if(!this.enableGrouping){ + if(!this.canGroup()){ return Ext.grid.GroupingView.superclass.getRows.call(this); } var r = []; @@ -522,7 +531,7 @@ var grid = new Ext.grid.GridPanel({ // private updateGroupWidths : function(){ - if(!this.enableGrouping || !this.hasRows()){ + if(!this.canGroup() || !this.hasRows()){ return; } var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px';