/** * @class Ext.grid.BooleanHeader * @extends Ext.grid.Header *A Column definition class which renders boolean data fields. See the {@link Ext.grid.Column#xtype xtype} * config option of {@link Ext.grid.Column} for more details.
*/ Ext.define('Ext.grid.BooleanHeader', { extend: 'Ext.grid.Header', alias: ['widget.booleanheader'], /** * @cfg {String} trueText * The string returned by the renderer when the column value is not falsey (defaults to 'true'). */ trueText: 'true', /** * @cfg {String} falseText * The string returned by the renderer when the column value is falsey (but not undefined) (defaults to * 'false'). */ falseText: 'false', /** * @cfg {String} undefinedText * The string returned by the renderer when the column value is undefined (defaults to ' '). */ undefinedText: ' ', constructor: function(cfg){ Ext.grid.BooleanHeader.superclass.constructor.call(this, cfg); var trueText = this.trueText, falseText = this.falseText, undefinedText = this.undefinedText; this.renderer = function(value){ if(value === undefined){ return undefinedText; } if(!value || value === 'false'){ return falseText; } return trueText; }; } });