4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-column-Boolean'>/**
19 </span> * @class Ext.grid.column.Boolean
20 * @extends Ext.grid.column.Column
21 * <p>A Column definition class which renders boolean data fields. See the {@link Ext.grid.column.Column#xtype xtype}
22 * config option of {@link Ext.grid.column.Column} for more details.</p>
24 * {@img Ext.grid.column.Boolean/Ext.grid.column.Boolean.png Ext.grid.column.Boolean grid column}
27 * Ext.create('Ext.data.Store', {
28 * storeId:'sampleStore',
30 * {name: 'framework', type: 'string'},
31 * {name: 'rocks', type: 'boolean'}
34 * {"framework":"Ext JS 4", "rocks":true},
35 * {"framework":"Sencha Touch", "rocks":true},
36 * {"framework":"Ext GWT", "rocks":true},
37 * {"framework":"Other Guys", "rocks":false}
48 * Ext.create('Ext.grid.Panel', {
49 * title: 'Boolean Column Demo',
50 * store: Ext.data.StoreManager.lookup('sampleStore'),
52 * {text: 'Framework', dataIndex: 'framework', flex: 1},
54 * xtype: 'booleancolumn',
62 * renderTo: Ext.getBody()
65 Ext.define('Ext.grid.column.Boolean', {
66 extend: 'Ext.grid.column.Column',
67 alias: ['widget.booleancolumn'],
68 alternateClassName: 'Ext.grid.BooleanColumn',
70 <span id='Ext-grid-column-Boolean-cfg-trueText'> /**
71 </span> * @cfg {String} trueText
72 * The string returned by the renderer when the column value is not falsey (defaults to <tt>'true'</tt>).
76 <span id='Ext-grid-column-Boolean-cfg-falseText'> /**
77 </span> * @cfg {String} falseText
78 * The string returned by the renderer when the column value is falsey (but not undefined) (defaults to
79 * <tt>'false'</tt>).
83 <span id='Ext-grid-column-Boolean-cfg-undefinedText'> /**
84 </span> * @cfg {String} undefinedText
85 * The string returned by the renderer when the column value is undefined (defaults to <tt>'&#160;'</tt>).
87 undefinedText: '&#160;',
89 constructor: function(cfg){
90 this.callParent(arguments);
91 var trueText = this.trueText,
92 falseText = this.falseText,
93 undefinedText = this.undefinedText;
95 this.renderer = function(value){
96 if(value === undefined){
99 if(!value || value === 'false'){