[625] | 1 | /*! |
---|
| 2 | * Ext JS Library 3.0.0 |
---|
| 3 | * Copyright(c) 2006-2009 Ext JS, LLC |
---|
| 4 | * licensing@extjs.com |
---|
| 5 | * http://www.extjs.com/license |
---|
| 6 | */ |
---|
| 7 | /** |
---|
| 8 | * @class Ext.grid.Column |
---|
| 9 | * <p>This class encapsulates column configuration data to be used in the initialization of a |
---|
| 10 | * {@link Ext.grid.ColumnModel ColumnModel}.</p> |
---|
| 11 | * <p>While subclasses are provided to render data in different ways, this class renders a passed |
---|
| 12 | * data field unchanged and is usually used for textual columns.</p> |
---|
| 13 | */ |
---|
| 14 | Ext.grid.Column = function(config){ |
---|
| 15 | Ext.apply(this, config); |
---|
| 16 | |
---|
| 17 | if(typeof this.renderer == 'string'){ |
---|
| 18 | this.renderer = Ext.util.Format[this.renderer]; |
---|
| 19 | } else if(Ext.isObject(this.renderer)){ |
---|
| 20 | this.scope = this.renderer.scope; |
---|
| 21 | this.renderer = this.renderer.fn; |
---|
| 22 | } |
---|
| 23 | this.renderer = this.renderer.createDelegate(this.scope || config); |
---|
| 24 | |
---|
| 25 | if(this.id === undefined){ |
---|
| 26 | this.id = ++Ext.grid.Column.AUTO_ID; |
---|
| 27 | } |
---|
| 28 | if(this.editor){ |
---|
| 29 | this.editor = Ext.create(this.editor, 'textfield'); |
---|
| 30 | } |
---|
| 31 | }; |
---|
| 32 | |
---|
| 33 | Ext.grid.Column.AUTO_ID = 0; |
---|
| 34 | |
---|
| 35 | Ext.grid.Column.prototype = { |
---|
| 36 | /** |
---|
| 37 | * @cfg {Boolean} editable Optional. Defaults to <tt>true</tt>, enabling the configured |
---|
| 38 | * <tt>{@link #editor}</tt>. Set to <tt>false</tt> to initially disable editing on this column. |
---|
| 39 | * The initial configuration may be dynamically altered using |
---|
| 40 | * {@link Ext.grid.ColumnModel}.{@link Ext.grid.ColumnModel#setEditable setEditable()}. |
---|
| 41 | */ |
---|
| 42 | /** |
---|
| 43 | * @cfg {String} id Optional. A name which identifies this column (defaults to the column's initial |
---|
| 44 | * ordinal position.) The <tt>id</tt> is used to create a CSS <b>class</b> name which is applied to all |
---|
| 45 | * table cells (including headers) in that column (in this context the <tt>id</tt> does not need to be |
---|
| 46 | * unique). The class name takes the form of <pre>x-grid3-td-<b>id</b></pre> |
---|
| 47 | * Header cells will also receive this class name, but will also have the class <pre>x-grid3-hd</pre> |
---|
| 48 | * So, to target header cells, use CSS selectors such as:<pre>.x-grid3-hd-row .x-grid3-td-<b>id</b></pre> |
---|
| 49 | * The {@link Ext.grid.GridPanel#autoExpandColumn} grid config option references the column via this |
---|
| 50 | * unique identifier. |
---|
| 51 | */ |
---|
| 52 | /** |
---|
| 53 | * @cfg {String} header Optional. The header text to be used as innerHTML |
---|
| 54 | * (html tags are accepted) to display in the Grid view. <b>Note</b>: to |
---|
| 55 | * have a clickable header with no text displayed use <tt>' '</tt>. |
---|
| 56 | */ |
---|
| 57 | /** |
---|
| 58 | * @cfg {Boolean} groupable Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option |
---|
| 59 | * may be used to disable the header menu item to group by the column selected. Defaults to <tt>true</tt>, |
---|
| 60 | * which enables the header menu group option. Set to <tt>false</tt> to disable (but still show) the |
---|
| 61 | * group option in the header menu for the column. See also <code>{@link #groupName}</code>. |
---|
| 62 | */ |
---|
| 63 | /** |
---|
| 64 | * @cfg {String} groupName Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option |
---|
| 65 | * may be used to specify the text with which to prefix the group field value in the group header line. |
---|
| 66 | * See also {@link #groupRenderer} and |
---|
| 67 | * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#showGroupName showGroupName}. |
---|
| 68 | */ |
---|
| 69 | /** |
---|
| 70 | * @cfg {Function} groupRenderer <p>Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option |
---|
| 71 | * may be used to specify the function used to format the grouping field value for display in the group |
---|
| 72 | * {@link #groupName header}. If a <tt><b>groupRenderer</b></tt> is not specified, the configured |
---|
| 73 | * <tt><b>{@link #renderer}</b></tt> will be called; if a <tt><b>{@link #renderer}</b></tt> is also not specified |
---|
| 74 | * the new value of the group field will be used.</p> |
---|
| 75 | * <p>The called function (either the <tt><b>groupRenderer</b></tt> or <tt><b>{@link #renderer}</b></tt>) will be |
---|
| 76 | * passed the following parameters: |
---|
| 77 | * <div class="mdetail-params"><ul> |
---|
| 78 | * <li><b>v</b> : Object<p class="sub-desc">The new value of the group field.</p></li> |
---|
| 79 | * <li><b>unused</b> : undefined<p class="sub-desc">Unused parameter.</p></li> |
---|
| 80 | * <li><b>r</b> : Ext.data.Record<p class="sub-desc">The Record providing the data |
---|
| 81 | * for the row which caused group change.</p></li> |
---|
| 82 | * <li><b>rowIndex</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li> |
---|
| 83 | * <li><b>colIndex</b> : Number<p class="sub-desc">The column index of the group field.</p></li> |
---|
| 84 | * <li><b>ds</b> : Ext.data.Store<p class="sub-desc">The Store which is providing the data Model.</p></li> |
---|
| 85 | * </ul></div></p> |
---|
| 86 | * <p>The function should return a string value.</p> |
---|
| 87 | */ |
---|
| 88 | /** |
---|
| 89 | * @cfg {String} emptyGroupText Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option |
---|
| 90 | * may be used to specify the text to display when there is an empty group value. Defaults to the |
---|
| 91 | * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#emptyGroupText emptyGroupText}. |
---|
| 92 | */ |
---|
| 93 | /** |
---|
| 94 | * @cfg {String} dataIndex <p><b>Required</b>. The name of the field in the |
---|
| 95 | * grid's {@link Ext.data.Store}'s {@link Ext.data.Record} definition from |
---|
| 96 | * which to draw the column's value.</p> |
---|
| 97 | */ |
---|
| 98 | /** |
---|
| 99 | * @cfg {Number} width |
---|
| 100 | * Optional. The initial width in pixels of the column. |
---|
| 101 | * The width of each column can also be affected if any of the following are configured: |
---|
| 102 | * <div class="mdetail-params"><ul> |
---|
| 103 | * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#autoExpandColumn autoExpandColumn}</tt></li> |
---|
| 104 | * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#forceFit forceFit}</tt> |
---|
| 105 | * <div class="sub-desc"> |
---|
| 106 | * <p>By specifying <tt>forceFit:true</tt>, {@link #fixed non-fixed width} columns will be |
---|
| 107 | * re-proportioned (based on the relative initial widths) to fill the width of the grid so |
---|
| 108 | * that no horizontal scrollbar is shown.</p> |
---|
| 109 | * </div></li> |
---|
| 110 | * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#autoFill autoFill}</tt></li> |
---|
| 111 | * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#minColumnWidth minColumnWidth}</tt></li> |
---|
| 112 | * <br><p><b>Note</b>: when the width of each column is determined, a space on the right side |
---|
| 113 | * is reserved for the vertical scrollbar. The |
---|
| 114 | * {@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#scrollOffset scrollOffset}</tt> |
---|
| 115 | * can be modified to reduce or eliminate the reserved offset.</p> |
---|
| 116 | */ |
---|
| 117 | /** |
---|
| 118 | * @cfg {Boolean} sortable Optional. <tt>true</tt> if sorting is to be allowed on this column. |
---|
| 119 | * Defaults to the value of the {@link #defaultSortable} property. |
---|
| 120 | * Whether local/remote sorting is used is specified in {@link Ext.data.Store#remoteSort}. |
---|
| 121 | */ |
---|
| 122 | /** |
---|
| 123 | * @cfg {Boolean} fixed Optional. <tt>true</tt> if the column width cannot be changed. Defaults to <tt>false</tt>. |
---|
| 124 | */ |
---|
| 125 | /** |
---|
| 126 | * @cfg {Boolean} resizable Optional. <tt>false</tt> to disable column resizing. Defaults to <tt>true</tt>. |
---|
| 127 | */ |
---|
| 128 | /** |
---|
| 129 | * @cfg {Boolean} menuDisabled Optional. <tt>true</tt> to disable the column menu. Defaults to <tt>false</tt>. |
---|
| 130 | */ |
---|
| 131 | /** |
---|
| 132 | * @cfg {Boolean} hidden Optional. <tt>true</tt> to hide the column. Defaults to <tt>false</tt>. |
---|
| 133 | */ |
---|
| 134 | /** |
---|
| 135 | * @cfg {String} tooltip Optional. A text string to use as the column header's tooltip. If Quicktips |
---|
| 136 | * are enabled, this value will be used as the text of the quick tip, otherwise it will be set as the |
---|
| 137 | * header's HTML title attribute. Defaults to ''. |
---|
| 138 | */ |
---|
| 139 | /** |
---|
| 140 | * @cfg {Mixed} renderer |
---|
| 141 | * <p>For an alternative to specifying a renderer see <code>{@link #xtype}</code></p> |
---|
| 142 | * <p>Optional. A renderer is an 'interceptor' method which can be used transform data (value, |
---|
| 143 | * appearance, etc.) before it is rendered). This may be specified in either of three ways: |
---|
| 144 | * <div class="mdetail-params"><ul> |
---|
| 145 | * <li>A renderer function used to return HTML markup for a cell given the cell's data value.</li> |
---|
| 146 | * <li>A string which references a property name of the {@link Ext.util.Format} class which |
---|
| 147 | * provides a renderer function.</li> |
---|
| 148 | * <li>An object specifying both the renderer function, and its execution scope (<tt><b>this</b></tt> |
---|
| 149 | * reference) e.g.:<pre style="margin-left:1.2em"><code> |
---|
| 150 | { |
---|
| 151 | fn: this.gridRenderer, |
---|
| 152 | scope: this |
---|
| 153 | } |
---|
| 154 | </code></pre></li></ul></div> |
---|
| 155 | * If not specified, the default renderer uses the raw data value.</p> |
---|
| 156 | * <p>For information about the renderer function (passed parameters, etc.), see |
---|
| 157 | * {@link Ext.grid.ColumnModel#setRenderer}. An example of specifying renderer function inline:</p><pre><code> |
---|
| 158 | var companyColumn = { |
---|
| 159 | header: 'Company Name', |
---|
| 160 | dataIndex: 'company', |
---|
| 161 | renderer: function(value, metaData, record, rowIndex, colIndex, store) { |
---|
| 162 | // provide the logic depending on business rules |
---|
| 163 | // name of your own choosing to manipulate the cell depending upon |
---|
| 164 | // the data in the underlying Record object. |
---|
| 165 | if (value == 'whatever') { |
---|
| 166 | //metaData.css : String : A CSS class name to add to the TD element of the cell. |
---|
| 167 | //metaData.attr : String : An html attribute definition string to apply to |
---|
| 168 | // the data container element within the table |
---|
| 169 | // cell (e.g. 'style="color:red;"'). |
---|
| 170 | metaData.css = 'name-of-css-class-you-will-define'; |
---|
| 171 | } |
---|
| 172 | return value; |
---|
| 173 | } |
---|
| 174 | } |
---|
| 175 | * </code></pre> |
---|
| 176 | * See also {@link #scope}. |
---|
| 177 | */ |
---|
| 178 | /** |
---|
| 179 | * @cfg {String} xtype Optional. A String which references a predefined {@link Ext.grid.Column} subclass |
---|
| 180 | * type which is preconfigured with an appropriate <code>{@link #renderer}</code> to be easily |
---|
| 181 | * configured into a ColumnModel. The predefined {@link Ext.grid.Column} subclass types are: |
---|
| 182 | * <div class="mdetail-params"><ul> |
---|
| 183 | * <li><b><tt>gridcolumn</tt></b> : {@link Ext.grid.Column} (<b>Default</b>)<p class="sub-desc"></p></li> |
---|
| 184 | * <li><b><tt>booleancolumn</tt></b> : {@link Ext.grid.BooleanColumn}<p class="sub-desc"></p></li> |
---|
| 185 | * <li><b><tt>numbercolumn</tt></b> : {@link Ext.grid.NumberColumn}<p class="sub-desc"></p></li> |
---|
| 186 | * <li><b><tt>datecolumn</tt></b> : {@link Ext.grid.DateColumn}<p class="sub-desc"></p></li> |
---|
| 187 | * <li><b><tt>templatecolumn</tt></b> : {@link Ext.grid.TemplateColumn}<p class="sub-desc"></p></li> |
---|
| 188 | * </ul></div> |
---|
| 189 | * <p>Configuration properties for the specified <code>xtype</code> may be specified with |
---|
| 190 | * the Column configuration properties, for example:</p> |
---|
| 191 | * <pre><code> |
---|
| 192 | var grid = new Ext.grid.GridPanel({ |
---|
| 193 | ... |
---|
| 194 | columns: [{ |
---|
| 195 | header: 'Last Updated', |
---|
| 196 | dataIndex: 'lastChange', |
---|
| 197 | width: 85, |
---|
| 198 | sortable: true, |
---|
| 199 | //renderer: Ext.util.Format.dateRenderer('m/d/Y'), |
---|
| 200 | xtype: 'datecolumn', // use xtype instead of renderer |
---|
| 201 | format: 'M/d/Y' // configuration property for {@link Ext.grid.DateColumn} |
---|
| 202 | }, { |
---|
| 203 | ... |
---|
| 204 | }] |
---|
| 205 | }); |
---|
| 206 | * </code></pre> |
---|
| 207 | */ |
---|
| 208 | /** |
---|
| 209 | * @cfg {Object} scope Optional. The scope (<tt><b>this</b></tt> reference) in which to execute the |
---|
| 210 | * renderer. Defaults to the Column configuration object. |
---|
| 211 | */ |
---|
| 212 | /** |
---|
| 213 | * @cfg {String} align Optional. Set the CSS text-align property of the column. Defaults to undefined. |
---|
| 214 | */ |
---|
| 215 | /** |
---|
| 216 | * @cfg {String} css Optional. An inline style definition string which is applied to all table cells in the column |
---|
| 217 | * (excluding headers). Defaults to undefined. |
---|
| 218 | */ |
---|
| 219 | /** |
---|
| 220 | * @cfg {Boolean} hideable Optional. Specify as <tt>false</tt> to prevent the user from hiding this column |
---|
| 221 | * (defaults to true). To disallow column hiding globally for all columns in the grid, use |
---|
| 222 | * {@link Ext.grid.GridPanel#enableColumnHide} instead. |
---|
| 223 | */ |
---|
| 224 | /** |
---|
| 225 | * @cfg {Ext.form.Field} editor Optional. The {@link Ext.form.Field} to use when editing values in this column |
---|
| 226 | * if editing is supported by the grid. See <tt>{@link #editable}</tt> also. |
---|
| 227 | */ |
---|
| 228 | |
---|
| 229 | // private. Used by ColumnModel to avoid reprocessing |
---|
| 230 | isColumn : true, |
---|
| 231 | /** |
---|
| 232 | * Optional. A function which returns displayable data when passed the following parameters: |
---|
| 233 | * <div class="mdetail-params"><ul> |
---|
| 234 | * <li><b>value</b> : Object<p class="sub-desc">The data value for the cell.</p></li> |
---|
| 235 | * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul> |
---|
| 236 | * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li> |
---|
| 237 | * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container |
---|
| 238 | * element <i>within</i> the table cell (e.g. 'style="color:red;"').</p></li></ul></p></li> |
---|
| 239 | * <li><b>record</b> : Ext.data.record<p class="sub-desc">The {@link Ext.data.Record} from which the data was |
---|
| 240 | * extracted.</p></li> |
---|
| 241 | * <li><b>rowIndex</b> : Number<p class="sub-desc">Row index</p></li> |
---|
| 242 | * <li><b>colIndex</b> : Number<p class="sub-desc">Column index</p></li> |
---|
| 243 | * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The {@link Ext.data.Store} object from which the Record |
---|
| 244 | * was extracted.</p></li> |
---|
| 245 | * </ul></div> |
---|
| 246 | * @property renderer |
---|
| 247 | * @type Function |
---|
| 248 | */ |
---|
| 249 | renderer : function(value){ |
---|
| 250 | if(typeof value == 'string' && value.length < 1){ |
---|
| 251 | return ' '; |
---|
| 252 | } |
---|
| 253 | return value; |
---|
| 254 | }, |
---|
| 255 | |
---|
| 256 | // private |
---|
| 257 | getEditor: function(rowIndex){ |
---|
| 258 | return this.editable !== false ? this.editor : null; |
---|
| 259 | }, |
---|
| 260 | |
---|
| 261 | /** |
---|
| 262 | * Returns the {@link Ext.Editor editor} defined for this column that was created to wrap the {@link Ext.form.Field Field} |
---|
| 263 | * used to edit the cell. |
---|
| 264 | * @param {Number} rowIndex The row index |
---|
| 265 | * @return {Ext.Editor} |
---|
| 266 | */ |
---|
| 267 | getCellEditor: function(rowIndex){ |
---|
| 268 | var editor = this.getEditor(rowIndex); |
---|
| 269 | if(editor){ |
---|
| 270 | if(!editor.startEdit){ |
---|
| 271 | if(!editor.gridEditor){ |
---|
| 272 | editor.gridEditor = new Ext.grid.GridEditor(editor); |
---|
| 273 | } |
---|
| 274 | return editor.gridEditor; |
---|
| 275 | }else if(editor.startEdit){ |
---|
| 276 | return editor; |
---|
| 277 | } |
---|
| 278 | } |
---|
| 279 | return null; |
---|
| 280 | } |
---|
| 281 | }; |
---|
| 282 | |
---|
| 283 | /** |
---|
| 284 | * @class Ext.grid.BooleanColumn |
---|
| 285 | * @extends Ext.grid.Column |
---|
| 286 | * <p>A Column definition class which renders boolean data fields. See the {@link Ext.grid.ColumnModel#xtype xtype} |
---|
| 287 | * config option of {@link Ext.grid.ColumnModel} for more details.</p> |
---|
| 288 | */ |
---|
| 289 | Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, { |
---|
| 290 | /** |
---|
| 291 | * @cfg {String} trueText |
---|
| 292 | * The string returned by the renderer when the column value is not falsey (defaults to <tt>'true'</tt>). |
---|
| 293 | */ |
---|
| 294 | trueText: 'true', |
---|
| 295 | /** |
---|
| 296 | * @cfg {String} falseText |
---|
| 297 | * The string returned by the renderer when the column value is falsey (but not undefined) (defaults to |
---|
| 298 | * <tt>'false'</tt>). |
---|
| 299 | */ |
---|
| 300 | falseText: 'false', |
---|
| 301 | /** |
---|
| 302 | * @cfg {String} undefinedText |
---|
| 303 | * The string returned by the renderer when the column value is undefined (defaults to <tt>' '</tt>). |
---|
| 304 | */ |
---|
| 305 | undefinedText: ' ', |
---|
| 306 | |
---|
| 307 | constructor: function(cfg){ |
---|
| 308 | Ext.grid.BooleanColumn.superclass.constructor.call(this, cfg); |
---|
| 309 | var t = this.trueText, f = this.falseText, u = this.undefinedText; |
---|
| 310 | this.renderer = function(v){ |
---|
| 311 | if(v === undefined){ |
---|
| 312 | return u; |
---|
| 313 | } |
---|
| 314 | if(!v || v === 'false'){ |
---|
| 315 | return f; |
---|
| 316 | } |
---|
| 317 | return t; |
---|
| 318 | }; |
---|
| 319 | } |
---|
| 320 | }); |
---|
| 321 | |
---|
| 322 | /** |
---|
| 323 | * @class Ext.grid.NumberColumn |
---|
| 324 | * @extends Ext.grid.Column |
---|
| 325 | * <p>A Column definition class which renders a numeric data field according to a {@link #format} string. See the |
---|
| 326 | * {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more details.</p> |
---|
| 327 | */ |
---|
| 328 | Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, { |
---|
| 329 | /** |
---|
| 330 | * @cfg {String} format |
---|
| 331 | * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column |
---|
| 332 | * (defaults to <tt>'0,000.00'</tt>). |
---|
| 333 | */ |
---|
| 334 | format : '0,000.00', |
---|
| 335 | constructor: function(cfg){ |
---|
| 336 | Ext.grid.NumberColumn.superclass.constructor.call(this, cfg); |
---|
| 337 | this.renderer = Ext.util.Format.numberRenderer(this.format); |
---|
| 338 | } |
---|
| 339 | }); |
---|
| 340 | |
---|
| 341 | /** |
---|
| 342 | * @class Ext.grid.DateColumn |
---|
| 343 | * @extends Ext.grid.Column |
---|
| 344 | * <p>A Column definition class which renders a passed date according to the default locale, or a configured |
---|
| 345 | * {@link #format}. See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} |
---|
| 346 | * for more details.</p> |
---|
| 347 | */ |
---|
| 348 | Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, { |
---|
| 349 | /** |
---|
| 350 | * @cfg {String} format |
---|
| 351 | * A formatting string as used by {@link Date#format} to format a Date for this Column |
---|
| 352 | * (defaults to <tt>'m/d/Y'</tt>). |
---|
| 353 | */ |
---|
| 354 | format : 'm/d/Y', |
---|
| 355 | constructor: function(cfg){ |
---|
| 356 | Ext.grid.DateColumn.superclass.constructor.call(this, cfg); |
---|
| 357 | this.renderer = Ext.util.Format.dateRenderer(this.format); |
---|
| 358 | } |
---|
| 359 | }); |
---|
| 360 | |
---|
| 361 | /** |
---|
| 362 | * @class Ext.grid.TemplateColumn |
---|
| 363 | * @extends Ext.grid.Column |
---|
| 364 | * <p>A Column definition class which renders a value by processing a {@link Ext.data.Record Record}'s |
---|
| 365 | * {@link Ext.data.Record#data data} using a {@link #tpl configured} {@link Ext.XTemplate XTemplate}. |
---|
| 366 | * See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more |
---|
| 367 | * details.</p> |
---|
| 368 | */ |
---|
| 369 | Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, { |
---|
| 370 | /** |
---|
| 371 | * @cfg {String/XTemplate} tpl |
---|
| 372 | * An {@link Ext.XTemplate XTemplate}, or an XTemplate <i>definition string</i> to use to process a |
---|
| 373 | * {@link Ext.data.Record Record}'s {@link Ext.data.Record#data data} to produce a column's rendered value. |
---|
| 374 | */ |
---|
| 375 | constructor: function(cfg){ |
---|
| 376 | Ext.grid.TemplateColumn.superclass.constructor.call(this, cfg); |
---|
| 377 | var tpl = typeof Ext.isObject(this.tpl) ? this.tpl : new Ext.XTemplate(this.tpl); |
---|
| 378 | this.renderer = function(value, p, r){ |
---|
| 379 | return tpl.apply(r.data); |
---|
| 380 | }; |
---|
| 381 | this.tpl = tpl; |
---|
| 382 | } |
---|
| 383 | }); |
---|
| 384 | |
---|
| 385 | /* |
---|
| 386 | * @property types |
---|
| 387 | * @type Object |
---|
| 388 | * @member Ext.grid.Column |
---|
| 389 | * @static |
---|
| 390 | * <p>An object containing predefined Column classes keyed by a mnemonic code which may be referenced |
---|
| 391 | * by the {@link Ext.grid.ColumnModel#xtype xtype} config option of ColumnModel.</p> |
---|
| 392 | * <p>This contains the following properties</p><div class="mdesc-details"><ul> |
---|
| 393 | * <li>gridcolumn : <b>{@link Ext.grid.Column Column constructor}</b></li> |
---|
| 394 | * <li>booleancolumn : <b>{@link Ext.grid.BooleanColumn BooleanColumn constructor}</b></li> |
---|
| 395 | * <li>numbercolumn : <b>{@link Ext.grid.NumberColumn NumberColumn constructor}</b></li> |
---|
| 396 | * <li>datecolumn : <b>{@link Ext.grid.DateColumn DateColumn constructor}</b></li> |
---|
| 397 | * <li>templatecolumn : <b>{@link Ext.grid.TemplateColumn TemplateColumn constructor}</b></li> |
---|
| 398 | * </ul></div> |
---|
| 399 | */ |
---|
| 400 | Ext.grid.Column.types = { |
---|
| 401 | gridcolumn : Ext.grid.Column, |
---|
| 402 | booleancolumn: Ext.grid.BooleanColumn, |
---|
| 403 | numbercolumn: Ext.grid.NumberColumn, |
---|
| 404 | datecolumn: Ext.grid.DateColumn, |
---|
| 405 | templatecolumn: Ext.grid.TemplateColumn |
---|
| 406 | }; |
---|