3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.grid.Column"></div>/**
16 * @class Ext.grid.Column
17 * <p>This class encapsulates column configuration data to be used in the initialization of a
18 * {@link Ext.grid.ColumnModel ColumnModel}.</p>
19 * <p>While subclasses are provided to render data in different ways, this class renders a passed
20 * data field unchanged and is usually used for textual columns.</p>
22 Ext.grid.Column = Ext.extend(Ext.util.Observable, {
23 <div id="cfg-Ext.grid.Column-editable"></div>/**
24 * @cfg {Boolean} editable Optional. Defaults to <tt>true</tt>, enabling the configured
25 * <tt>{@link #editor}</tt>. Set to <tt>false</tt> to initially disable editing on this column.
26 * The initial configuration may be dynamically altered using
27 * {@link Ext.grid.ColumnModel}.{@link Ext.grid.ColumnModel#setEditable setEditable()}.
29 <div id="cfg-Ext.grid.Column-id"></div>/**
30 * @cfg {String} id Optional. A name which identifies this column (defaults to the column's initial
31 * ordinal position.) The <tt>id</tt> is used to create a CSS <b>class</b> name which is applied to all
32 * table cells (including headers) in that column (in this context the <tt>id</tt> does not need to be
33 * unique). The class name takes the form of <pre>x-grid3-td-<b>id</b></pre>
34 * Header cells will also receive this class name, but will also have the class <pre>x-grid3-hd</pre>
35 * So, to target header cells, use CSS selectors such as:<pre>.x-grid3-hd-row .x-grid3-td-<b>id</b></pre>
36 * The {@link Ext.grid.GridPanel#autoExpandColumn} grid config option references the column via this
39 <div id="cfg-Ext.grid.Column-header"></div>/**
40 * @cfg {String} header Optional. The header text to be used as innerHTML
41 * (html tags are accepted) to display in the Grid view. <b>Note</b>: to
42 * have a clickable header with no text displayed use <tt>'&#160;'</tt>.
44 <div id="cfg-Ext.grid.Column-groupable"></div>/**
45 * @cfg {Boolean} groupable Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option
46 * may be used to disable the header menu item to group by the column selected. Defaults to <tt>true</tt>,
47 * which enables the header menu group option. Set to <tt>false</tt> to disable (but still show) the
48 * group option in the header menu for the column. See also <code>{@link #groupName}</code>.
50 <div id="cfg-Ext.grid.Column-groupName"></div>/**
51 * @cfg {String} groupName Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option
52 * may be used to specify the text with which to prefix the group field value in the group header line.
53 * See also {@link #groupRenderer} and
54 * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#showGroupName showGroupName}.
56 <div id="cfg-Ext.grid.Column-groupRenderer"></div>/**
57 * @cfg {Function} groupRenderer <p>Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option
58 * may be used to specify the function used to format the grouping field value for display in the group
59 * {@link #groupName header}. If a <tt><b>groupRenderer</b></tt> is not specified, the configured
60 * <tt><b>{@link #renderer}</b></tt> will be called; if a <tt><b>{@link #renderer}</b></tt> is also not specified
61 * the new value of the group field will be used.</p>
62 * <p>The called function (either the <tt><b>groupRenderer</b></tt> or <tt><b>{@link #renderer}</b></tt>) will be
63 * passed the following parameters:
64 * <div class="mdetail-params"><ul>
65 * <li><b>v</b> : Object<p class="sub-desc">The new value of the group field.</p></li>
66 * <li><b>unused</b> : undefined<p class="sub-desc">Unused parameter.</p></li>
67 * <li><b>r</b> : Ext.data.Record<p class="sub-desc">The Record providing the data
68 * for the row which caused group change.</p></li>
69 * <li><b>rowIndex</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>
70 * <li><b>colIndex</b> : Number<p class="sub-desc">The column index of the group field.</p></li>
71 * <li><b>ds</b> : Ext.data.Store<p class="sub-desc">The Store which is providing the data Model.</p></li>
73 * <p>The function should return a string value.</p>
75 <div id="cfg-Ext.grid.Column-emptyGroupText"></div>/**
76 * @cfg {String} emptyGroupText Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option
77 * may be used to specify the text to display when there is an empty group value. Defaults to the
78 * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#emptyGroupText emptyGroupText}.
80 <div id="cfg-Ext.grid.Column-dataIndex"></div>/**
81 * @cfg {String} dataIndex <p><b>Required</b>. The name of the field in the
82 * grid's {@link Ext.data.Store}'s {@link Ext.data.Record} definition from
83 * which to draw the column's value.</p>
85 <div id="cfg-Ext.grid.Column-width"></div>/**
87 * Optional. The initial width in pixels of the column.
88 * The width of each column can also be affected if any of the following are configured:
89 * <div class="mdetail-params"><ul>
90 * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#autoExpandColumn autoExpandColumn}</tt></li>
91 * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#forceFit forceFit}</tt>
92 * <div class="sub-desc">
93 * <p>By specifying <tt>forceFit:true</tt>, {@link #fixed non-fixed width} columns will be
94 * re-proportioned (based on the relative initial widths) to fill the width of the grid so
95 * that no horizontal scrollbar is shown.</p>
97 * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#autoFill autoFill}</tt></li>
98 * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#minColumnWidth minColumnWidth}</tt></li>
99 * <br><p><b>Note</b>: when the width of each column is determined, a space on the right side
100 * is reserved for the vertical scrollbar. The
101 * {@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#scrollOffset scrollOffset}</tt>
102 * can be modified to reduce or eliminate the reserved offset.</p>
104 <div id="cfg-Ext.grid.Column-sortable"></div>/**
105 * @cfg {Boolean} sortable Optional. <tt>true</tt> if sorting is to be allowed on this column.
106 * Defaults to the value of the <code>{@link Ext.grid.ColumnModel#defaultSortable}</code> property.
107 * Whether local/remote sorting is used is specified in <code>{@link Ext.data.Store#remoteSort}</code>.
109 <div id="cfg-Ext.grid.Column-fixed"></div>/**
110 * @cfg {Boolean} fixed Optional. <tt>true</tt> if the column width cannot be changed. Defaults to <tt>false</tt>.
112 <div id="cfg-Ext.grid.Column-resizable"></div>/**
113 * @cfg {Boolean} resizable Optional. <tt>false</tt> to disable column resizing. Defaults to <tt>true</tt>.
115 <div id="cfg-Ext.grid.Column-menuDisabled"></div>/**
116 * @cfg {Boolean} menuDisabled Optional. <tt>true</tt> to disable the column menu. Defaults to <tt>false</tt>.
118 <div id="cfg-Ext.grid.Column-hidden"></div>/**
119 * @cfg {Boolean} hidden
120 * Optional. <tt>true</tt> to initially hide this column. Defaults to <tt>false</tt>.
121 * A hidden column {@link Ext.grid.GridPanel#enableColumnHide may be shown via the header row menu}.
122 * If a column is never to be shown, simply do not include this column in the Column Model at all.
124 <div id="cfg-Ext.grid.Column-tooltip"></div>/**
125 * @cfg {String} tooltip Optional. A text string to use as the column header's tooltip. If Quicktips
126 * are enabled, this value will be used as the text of the quick tip, otherwise it will be set as the
127 * header's HTML title attribute. Defaults to ''.
129 <div id="cfg-Ext.grid.Column-renderer"></div>/**
130 * @cfg {Mixed} renderer
131 * <p>For an alternative to specifying a renderer see <code>{@link #xtype}</code></p>
132 * <p>Optional. A renderer is an 'interceptor' method which can be used transform data (value,
133 * appearance, etc.) before it is rendered). This may be specified in either of three ways:
134 * <div class="mdetail-params"><ul>
135 * <li>A renderer function used to return HTML markup for a cell given the cell's data value.</li>
136 * <li>A string which references a property name of the {@link Ext.util.Format} class which
137 * provides a renderer function.</li>
138 * <li>An object specifying both the renderer function, and its execution scope (<tt><b>this</b></tt>
139 * reference) e.g.:<pre style="margin-left:1.2em"><code>
141 fn: this.gridRenderer,
144 </code></pre></li></ul></div>
145 * If not specified, the default renderer uses the raw data value.</p>
146 * <p>For information about the renderer function (passed parameters, etc.), see
147 * {@link Ext.grid.ColumnModel#setRenderer}. An example of specifying renderer function inline:</p><pre><code>
148 var companyColumn = {
149 header: 'Company Name',
150 dataIndex: 'company',
151 renderer: function(value, metaData, record, rowIndex, colIndex, store) {
152 // provide the logic depending on business rules
153 // name of your own choosing to manipulate the cell depending upon
154 // the data in the underlying Record object.
155 if (value == 'whatever') {
156 //metaData.css : String : A CSS class name to add to the TD element of the cell.
157 //metaData.attr : String : An html attribute definition string to apply to
158 // the data container element within the table
159 // cell (e.g. 'style="color:red;"').
160 metaData.css = 'name-of-css-class-you-will-define';
166 * See also {@link #scope}.
168 <div id="cfg-Ext.grid.Column-xtype"></div>/**
169 * @cfg {String} xtype Optional. A String which references a predefined {@link Ext.grid.Column} subclass
170 * type which is preconfigured with an appropriate <code>{@link #renderer}</code> to be easily
171 * configured into a ColumnModel. The predefined {@link Ext.grid.Column} subclass types are:
172 * <div class="mdetail-params"><ul>
173 * <li><b><tt>gridcolumn</tt></b> : {@link Ext.grid.Column} (<b>Default</b>)<p class="sub-desc"></p></li>
174 * <li><b><tt>booleancolumn</tt></b> : {@link Ext.grid.BooleanColumn}<p class="sub-desc"></p></li>
175 * <li><b><tt>numbercolumn</tt></b> : {@link Ext.grid.NumberColumn}<p class="sub-desc"></p></li>
176 * <li><b><tt>datecolumn</tt></b> : {@link Ext.grid.DateColumn}<p class="sub-desc"></p></li>
177 * <li><b><tt>templatecolumn</tt></b> : {@link Ext.grid.TemplateColumn}<p class="sub-desc"></p></li>
179 * <p>Configuration properties for the specified <code>xtype</code> may be specified with
180 * the Column configuration properties, for example:</p>
182 var grid = new Ext.grid.GridPanel({
185 header: 'Last Updated',
186 dataIndex: 'lastChange',
189 //renderer: Ext.util.Format.dateRenderer('m/d/Y'),
190 xtype: 'datecolumn', // use xtype instead of renderer
191 format: 'M/d/Y' // configuration property for {@link Ext.grid.DateColumn}
198 <div id="cfg-Ext.grid.Column-scope"></div>/**
199 * @cfg {Object} scope Optional. The scope (<tt><b>this</b></tt> reference) in which to execute the
200 * renderer. Defaults to the Column configuration object.
202 <div id="cfg-Ext.grid.Column-align"></div>/**
203 * @cfg {String} align Optional. Set the CSS text-align property of the column. Defaults to undefined.
205 <div id="cfg-Ext.grid.Column-css"></div>/**
206 * @cfg {String} css Optional. An inline style definition string which is applied to all table cells in the column
207 * (excluding headers). Defaults to undefined.
209 <div id="cfg-Ext.grid.Column-hideable"></div>/**
210 * @cfg {Boolean} hideable Optional. Specify as <tt>false</tt> to prevent the user from hiding this column
211 * (defaults to true). To disallow column hiding globally for all columns in the grid, use
212 * {@link Ext.grid.GridPanel#enableColumnHide} instead.
214 <div id="cfg-Ext.grid.Column-editor"></div>/**
215 * @cfg {Ext.form.Field} editor Optional. The {@link Ext.form.Field} to use when editing values in this column
216 * if editing is supported by the grid. See <tt>{@link #editable}</tt> also.
221 * @cfg {Boolean} isColumn
222 * Used by ColumnModel setConfig method to avoid reprocessing a Column
223 * if <code>isColumn</code> is not set ColumnModel will recreate a new Ext.grid.Column
228 constructor : function(config){
229 Ext.apply(this, config);
231 if(Ext.isString(this.renderer)){
232 this.renderer = Ext.util.Format[this.renderer];
233 }else if(Ext.isObject(this.renderer)){
234 this.scope = this.renderer.scope;
235 this.renderer = this.renderer.fn;
241 var ed = this.editor;
245 <div id="event-Ext.grid.Column-click"></div>/**
247 * Fires when this Column is clicked.
248 * @param {Column} this
249 * @param {Grid} The owning GridPanel
250 * @param {Number} rowIndex
251 * @param {Ext.EventObject} e
254 <div id="event-Ext.grid.Column-contextmenu"></div>/**
256 * Fires when this Column is right clicked.
257 * @param {Column} this
258 * @param {Grid} The owning GridPanel
259 * @param {Number} rowIndex
260 * @param {Ext.EventObject} e
263 <div id="event-Ext.grid.Column-dblclick"></div>/**
265 * Fires when this Column is double clicked.
266 * @param {Column} this
267 * @param {Grid} The owning GridPanel
268 * @param {Number} rowIndex
269 * @param {Ext.EventObject} e
272 <div id="event-Ext.grid.Column-mousedown"></div>/**
274 * Fires when this Column receives a mousedown event.
275 * @param {Column} this
276 * @param {Grid} The owning GridPanel
277 * @param {Number} rowIndex
278 * @param {Ext.EventObject} e
282 Ext.grid.Column.superclass.constructor.call(this);
287 * Process and refire events routed from the GridView's processEvent method.
288 * Returns the event handler's status to allow cancelling of GridView's bubbling process.
290 processEvent : function(name, e, grid, rowIndex, colIndex){
291 return this.fireEvent(name, this, grid, rowIndex, e);
296 * Clean up. Remove any Editor. Remove any listeners.
298 destroy: function() {
300 this.setEditor(null);
302 this.purgeListeners();
305 <div id="prop-Ext.grid.Column-renderer"></div>/**
306 * Optional. A function which returns displayable data when passed the following parameters:
307 * <div class="mdetail-params"><ul>
308 * <li><b>value</b> : Object<p class="sub-desc">The data value for the cell.</p></li>
309 * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>
310 * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>
311 * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container
312 * element <i>within</i> the table cell (e.g. 'style="color:red;"').</p></li></ul></p></li>
313 * <li><b>record</b> : Ext.data.record<p class="sub-desc">The {@link Ext.data.Record} from which the data was
314 * extracted.</p></li>
315 * <li><b>rowIndex</b> : Number<p class="sub-desc">Row index</p></li>
316 * <li><b>colIndex</b> : Number<p class="sub-desc">Column index</p></li>
317 * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The {@link Ext.data.Store} object from which the Record
318 * was extracted.</p></li>
323 renderer : function(value){
328 getEditor: function(rowIndex){
329 return this.editable !== false ? this.editor : null;
332 <div id="method-Ext.grid.Column-setEditor"></div>/**
333 * Sets a new editor for this column.
334 * @param {Ext.Editor/Ext.form.Field} editor The editor to set
336 setEditor : function(editor){
337 var ed = this.editor;
340 ed.gridEditor.destroy();
341 delete ed.gridEditor;
348 //not an instance, create it
350 editor = Ext.create(editor, 'textfield');
352 this.editor = editor;
356 <div id="method-Ext.grid.Column-getCellEditor"></div>/**
357 * Returns the {@link Ext.Editor editor} defined for this column that was created to wrap the {@link Ext.form.Field Field}
358 * used to edit the cell.
359 * @param {Number} rowIndex The row index
360 * @return {Ext.Editor}
362 getCellEditor: function(rowIndex){
363 var ed = this.getEditor(rowIndex);
367 ed.gridEditor = new Ext.grid.GridEditor(ed);
376 <div id="cls-Ext.grid.BooleanColumn"></div>/**
377 * @class Ext.grid.BooleanColumn
378 * @extends Ext.grid.Column
379 * <p>A Column definition class which renders boolean data fields. See the {@link Ext.grid.Column#xtype xtype}
380 * config option of {@link Ext.grid.Column} for more details.</p>
382 Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, {
383 <div id="cfg-Ext.grid.BooleanColumn-trueText"></div>/**
384 * @cfg {String} trueText
385 * The string returned by the renderer when the column value is not falsy (defaults to <tt>'true'</tt>).
388 <div id="cfg-Ext.grid.BooleanColumn-falseText"></div>/**
389 * @cfg {String} falseText
390 * The string returned by the renderer when the column value is falsy (but not undefined) (defaults to
394 <div id="cfg-Ext.grid.BooleanColumn-undefinedText"></div>/**
395 * @cfg {String} undefinedText
396 * The string returned by the renderer when the column value is undefined (defaults to <tt>'&#160;'</tt>).
398 undefinedText: ' ',
400 constructor: function(cfg){
401 Ext.grid.BooleanColumn.superclass.constructor.call(this, cfg);
402 var t = this.trueText, f = this.falseText, u = this.undefinedText;
403 this.renderer = function(v){
407 if(!v || v === 'false'){
415 <div id="cls-Ext.grid.NumberColumn"></div>/**
416 * @class Ext.grid.NumberColumn
417 * @extends Ext.grid.Column
418 * <p>A Column definition class which renders a numeric data field according to a {@link #format} string. See the
419 * {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column} for more details.</p>
421 Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, {
422 <div id="cfg-Ext.grid.NumberColumn-format"></div>/**
423 * @cfg {String} format
424 * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column
425 * (defaults to <tt>'0,000.00'</tt>).
428 constructor: function(cfg){
429 Ext.grid.NumberColumn.superclass.constructor.call(this, cfg);
430 this.renderer = Ext.util.Format.numberRenderer(this.format);
434 <div id="cls-Ext.grid.DateColumn"></div>/**
435 * @class Ext.grid.DateColumn
436 * @extends Ext.grid.Column
437 * <p>A Column definition class which renders a passed date according to the default locale, or a configured
438 * {@link #format}. See the {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column}
439 * for more details.</p>
441 Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {
442 <div id="cfg-Ext.grid.DateColumn-format"></div>/**
443 * @cfg {String} format
444 * A formatting string as used by {@link Date#format} to format a Date for this Column
445 * (defaults to <tt>'m/d/Y'</tt>).
448 constructor: function(cfg){
449 Ext.grid.DateColumn.superclass.constructor.call(this, cfg);
450 this.renderer = Ext.util.Format.dateRenderer(this.format);
454 <div id="cls-Ext.grid.TemplateColumn"></div>/**
455 * @class Ext.grid.TemplateColumn
456 * @extends Ext.grid.Column
457 * <p>A Column definition class which renders a value by processing a {@link Ext.data.Record Record}'s
458 * {@link Ext.data.Record#data data} using a {@link #tpl configured} {@link Ext.XTemplate XTemplate}.
459 * See the {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column} for more
462 Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, {
463 <div id="cfg-Ext.grid.TemplateColumn-tpl"></div>/**
464 * @cfg {String/XTemplate} tpl
465 * An {@link Ext.XTemplate XTemplate}, or an XTemplate <i>definition string</i> to use to process a
466 * {@link Ext.data.Record Record}'s {@link Ext.data.Record#data data} to produce a column's rendered value.
468 constructor: function(cfg){
469 Ext.grid.TemplateColumn.superclass.constructor.call(this, cfg);
470 var tpl = (!Ext.isPrimitive(this.tpl) && this.tpl.compile) ? this.tpl : new Ext.XTemplate(this.tpl);
471 this.renderer = function(value, p, r){
472 return tpl.apply(r.data);
478 <div id="cls-Ext.grid.ActionColumn"></div>/**
479 * @class Ext.grid.ActionColumn
480 * @extends Ext.grid.Column
481 * <p>A Grid column type which renders an icon, or a series of icons in a grid cell, and offers a scoped click
482 * handler for each icon. Example usage:</p>
484 new Ext.grid.GridPanel({
488 xtype: 'actioncolumn',
492 icon : 'sell.gif', // Use a URL in the icon config
493 tooltip: 'Sell stock',
494 handler: function(grid, rowIndex, colIndex) {
495 var rec = store.getAt(rowIndex);
496 alert("Sell " + rec.get('company'));
500 getClass: function(v, meta, rec) { // Or return a class from a function
501 if (rec.get('change') < 0) {
502 this.items[1].tooltip = 'Do not buy!';
505 this.items[1].tooltip = 'Buy stock';
509 handler: function(grid, rowIndex, colIndex) {
510 var rec = store.getAt(rowIndex);
511 alert("Buy " + rec.get('company'));
516 //any other columns here
520 * <p>The action column can be at any index in the columns array, and a grid can have any number of
521 * action columns. </p>
523 Ext.grid.ActionColumn = Ext.extend(Ext.grid.Column, {
524 <div id="cfg-Ext.grid.ActionColumn-icon"></div>/**
526 * The URL of an image to display as the clickable element in the column.
527 * Optional - defaults to <code>{@link Ext#BLANK_IMAGE_URL Ext.BLANK_IMAGE_URL}</code>.
529 <div id="cfg-Ext.grid.ActionColumn-iconCls"></div>/**
530 * @cfg {String} iconCls
531 * A CSS class to apply to the icon image. To determine the class dynamically, configure the Column with a <code>{@link #getClass}</code> function.
533 <div id="cfg-Ext.grid.ActionColumn-handler"></div>/**
534 * @cfg {Function} handler A function called when the icon is clicked.
535 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
536 * <li><code>grid</code> : GridPanel<div class="sub-desc">The owning GridPanel.</div></li>
537 * <li><code>rowIndex</code> : Number<div class="sub-desc">The row index clicked on.</div></li>
538 * <li><code>colIndex</code> : Number<div class="sub-desc">The column index clicked on.</div></li>
539 * <li><code>item</code> : Object<div class="sub-desc">The clicked item (or this Column if multiple
540 * {@link #items} were not configured).</div></li>
541 * <li><code>e</code> : Event<div class="sub-desc">The click event.</div></li>
544 <div id="cfg-Ext.grid.ActionColumn-scope"></div>/**
545 * @cfg {Object} scope The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
546 * and <code>{@link #getClass}</code> fuctions are executed. Defaults to this Column.
548 <div id="cfg-Ext.grid.ActionColumn-tooltip"></div>/**
549 * @cfg {String} tooltip A tooltip message to be displayed on hover. {@link Ext.QuickTips#init Ext.QuickTips} must have
552 <div id="cfg-Ext.grid.ActionColumn-stopSelection"></div>/**
553 * @cfg {Boolean} stopSelection Defaults to <code>true</code>. Prevent grid <i>row</i> selection upon mousedown.
555 <div id="cfg-Ext.grid.ActionColumn-getClass"></div>/**
556 * @cfg {Function} getClass A function which returns the CSS class to apply to the icon image.
557 * The function is passed the following parameters:<div class="mdetail-params"><ul>
558 * <li><b>v</b> : Object<p class="sub-desc">The value of the column's configured field (if any).</p></li>
559 * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>
560 * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>
561 * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container element <i>within</i> the table cell
562 * (e.g. 'style="color:red;"').</p></li>
564 * <li><b>r</b> : Ext.data.Record<p class="sub-desc">The Record providing the data.</p></li>
565 * <li><b>rowIndex</b> : Number<p class="sub-desc">The row index..</p></li>
566 * <li><b>colIndex</b> : Number<p class="sub-desc">The column index.</p></li>
567 * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The Store which is providing the data Model.</p></li>
570 <div id="cfg-Ext.grid.ActionColumn-items"></div>/**
571 * @cfg {Array} items An Array which may contain multiple icon definitions, each element of which may contain:
572 * <div class="mdetail-params"><ul>
573 * <li><code>icon</code> : String<div class="sub-desc">The url of an image to display as the clickable element
574 * in the column.</div></li>
575 * <li><code>iconCls</code> : String<div class="sub-desc">A CSS class to apply to the icon image.
576 * To determine the class dynamically, configure the item with a <code>getClass</code> function.</div></li>
577 * <li><code>getClass</code> : Function<div class="sub-desc">A function which returns the CSS class to apply to the icon image.
578 * The function is passed the following parameters:<ul>
579 * <li><b>v</b> : Object<p class="sub-desc">The value of the column's configured field (if any).</p></li>
580 * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>
581 * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>
582 * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container element <i>within</i> the table cell
583 * (e.g. 'style="color:red;"').</p></li>
585 * <li><b>r</b> : Ext.data.Record<p class="sub-desc">The Record providing the data.</p></li>
586 * <li><b>rowIndex</b> : Number<p class="sub-desc">The row index..</p></li>
587 * <li><b>colIndex</b> : Number<p class="sub-desc">The column index.</p></li>
588 * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The Store which is providing the data Model.</p></li>
590 * <li><code>handler</code> : Function<div class="sub-desc">A function called when the icon is clicked.</div></li>
591 * <li><code>scope</code> : Scope<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the
592 * <code>handler</code> and <code>getClass</code> functions are executed. Fallback defaults are this Column's
593 * configured scope, then this Column.</div></li>
594 * <li><code>tooltip</code> : String<div class="sub-desc">A tooltip message to be displayed on hover.
595 * {@link Ext.QuickTips#init Ext.QuickTips} must have been initialized.</div></li>
600 actionIdRe: /x-action-col-(\d+)/,
602 <div id="cfg-Ext.grid.ActionColumn-altText"></div>/**
603 * @cfg {String} altText The alt text to use for the image element. Defaults to <tt>''</tt>.
607 constructor: function(cfg) {
609 items = cfg.items || (me.items = [me]),
614 Ext.grid.ActionColumn.superclass.constructor.call(me, cfg);
616 // Renderer closure iterates through items creating an <img> element for each and tagging with an identifying
617 // class name x-action-col-{n}
618 me.renderer = function(v, meta) {
619 // Allow a configured renderer to create initial value (And set the other values in the "metadata" argument!)
620 v = Ext.isFunction(cfg.renderer) ? cfg.renderer.apply(this, arguments)||'' : '';
622 meta.css += ' x-action-col-cell';
623 for (i = 0; i < l; i++) {
625 v += '<img alt="' + me.altText + '" src="' + (item.icon || Ext.BLANK_IMAGE_URL) +
626 '" class="x-action-col-icon x-action-col-' + String(i) + ' ' + (item.iconCls || '') +
627 ' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope||this.scope||this, arguments) : '') + '"' +
628 ((item.tooltip) ? ' ext:qtip="' + item.tooltip + '"' : '') + ' />';
634 destroy: function() {
636 delete this.renderer;
637 return Ext.grid.ActionColumn.superclass.destroy.apply(this, arguments);
642 * Process and refire events routed from the GridView's processEvent method.
643 * Also fires any configured click handlers. By default, cancels the mousedown event to prevent selection.
644 * Returns the event handler's status to allow cancelling of GridView's bubbling process.
646 processEvent : function(name, e, grid, rowIndex, colIndex){
647 var m = e.getTarget().className.match(this.actionIdRe),
649 if (m && (item = this.items[parseInt(m[1], 10)])) {
650 if (name == 'click') {
651 (fn = item.handler || this.handler) && fn.call(item.scope||this.scope||this, grid, rowIndex, colIndex, item, e);
652 } else if ((name == 'mousedown') && (item.stopSelection !== false)) {
656 return Ext.grid.ActionColumn.superclass.processEvent.apply(this, arguments);
663 * @member Ext.grid.Column
665 * <p>An object containing predefined Column classes keyed by a mnemonic code which may be referenced
666 * by the {@link Ext.grid.ColumnModel#xtype xtype} config option of ColumnModel.</p>
667 * <p>This contains the following properties</p><div class="mdesc-details"><ul>
668 * <li>gridcolumn : <b>{@link Ext.grid.Column Column constructor}</b></li>
669 * <li>booleancolumn : <b>{@link Ext.grid.BooleanColumn BooleanColumn constructor}</b></li>
670 * <li>numbercolumn : <b>{@link Ext.grid.NumberColumn NumberColumn constructor}</b></li>
671 * <li>datecolumn : <b>{@link Ext.grid.DateColumn DateColumn constructor}</b></li>
672 * <li>templatecolumn : <b>{@link Ext.grid.TemplateColumn TemplateColumn constructor}</b></li>
675 Ext.grid.Column.types = {
676 gridcolumn : Ext.grid.Column,
677 booleancolumn: Ext.grid.BooleanColumn,
678 numbercolumn: Ext.grid.NumberColumn,
679 datecolumn: Ext.grid.DateColumn,
680 templatecolumn: Ext.grid.TemplateColumn,
681 actioncolumn: Ext.grid.ActionColumn