Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/pkgs/pkg-grid-grouping-debug.js view on Meta::CPAN
if (this.enableNoGroups) {
this.hmenu.add({
itemId:'showGroups',
text: this.showGroupsText,
checked: true,
checkHandler: this.onShowGroupsClick,
scope: this
});
}
this.hmenu.on('beforeshow', this.beforeMenuShow, this);
}
},
// private
renderRows : function(){
var groupField = this.getGroupField();
var eg = !!groupField;
// if they turned off grouping and the last grouped field is hidden
if(this.hideGroupedColumn) {
var colIndex = this.cm.findColumnIndex(groupField),
hasLastGroupField = Ext.isDefined(this.lastGroupField);
if(!eg && hasLastGroupField){
this.mainBody.update('');
this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);
delete this.lastGroupField;
}else if (eg && !hasLastGroupField){
this.lastGroupField = groupField;
this.cm.setHidden(colIndex, true);
}else if (eg && hasLastGroupField && groupField !== this.lastGroupField) {
this.mainBody.update('');
var oldIndex = this.cm.findColumnIndex(this.lastGroupField);
this.cm.setHidden(oldIndex, false);
this.lastGroupField = groupField;
this.cm.setHidden(colIndex, true);
}
}
return Ext.grid.GroupingView.superclass.renderRows.apply(
this, arguments);
},
// private
doRender : function(cs, rs, ds, startRow, colCount, stripe){
if(rs.length < 1){
return '';
}
if(!this.canGroup() || this.isUpdating){
return Ext.grid.GroupingView.superclass.doRender.apply(this, arguments);
}
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)+': ' : '',
groups = [],
curGroup, i, len, gid;
for(i = 0, len = rs.length; i < len; i++){
var rowIndex = startRow + i,
r = rs[i],
gvalue = r.data[groupField];
g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);
if(!curGroup || curGroup.group != g){
gid = this.constructId(gvalue, groupField, colIndex);
// if state is defined use it, however state is in terms of expanded
// so negate it, otherwise use the default.
this.state[gid] = !(Ext.isDefined(this.state[gid]) ? !this.state[gid] : this.startCollapsed);
curGroup = {
group: g,
gvalue: gvalue,
text: prefix + g,
groupId: gid,
startRow: rowIndex,
rs: [r],
cls: this.state[gid] ? '' : 'x-grid-group-collapsed',
style: gstyle
};
groups.push(curGroup);
}else{
curGroup.rs.push(r);
}
r._groupId = gid;
}
var buf = [];
for(i = 0, len = groups.length; i < len; i++){
g = groups[i];
this.doGroupStart(buf, g, cs, ds, colCount);
buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(
this, cs, g.rs, ds, g.startRow, colCount, stripe);
this.doGroupEnd(buf, g, cs, ds, colCount);
}
return buf.join('');
},
/**
* Dynamically tries to determine the groupId of a specific value
* @param {String} value
* @return {String} The group id
*/
getGroupId : function(value){
var field = this.getGroupField();
return this.constructId(value, field, this.cm.findColumnIndex(field));
},
// private
constructId : function(value, 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 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 + '-';
},
// private
doGroupStart : function(buf, g, cs, ds, colCount){
buf[buf.length] = this.startGroup.apply(g);
},
// private
doGroupEnd : function(buf, g, cs, ds, colCount){
buf[buf.length] = this.endGroup;
},
// private
getRows : function(){
if(!this.canGroup()){
return Ext.grid.GroupingView.superclass.getRows.call(this);
}
var r = [],
gs = this.getGroups(),
( run in 1.857 second using v1.01-cache-2.11-cpan-97f6503c9c8 )