Ext.ux.ProgressColumn = Ext.extend(Ext.grid.Column, {
tpl: new Ext.XTemplate(
'',
'',
'',
'',
'',
'',
'',
''
),
constructor: function(config) {
this.baseRenderer = config.renderer;
Ext.grid.Column.call(this, config);
this.renderer = Ext.ux.ProgressColumn.prototype.renderer.createDelegate(this);
},
// private
renderer: function(val, meta, record, rowIndex, colIndex, store) {
var display = this.baseRenderer.apply(this, arguments);
if (!display) {display = Math.floor(val*100)+'%';}
if (val == 0 || val == 1) {
return display;
} else {
meta.css += ' x-grid3-td-progress-cell';
return this.tpl.apply({
align: this.align || 'left',
value: display,
pct: Math.floor(val*100)
});
}
}
});