X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/src/grid/column/Action.js diff --git a/src/grid/column/Action.js b/src/grid/column/Action.js index 07923656..f6bde6c9 100644 --- a/src/grid/column/Action.js +++ b/src/grid/column/Action.js @@ -1,12 +1,22 @@ +/* + +This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. + +*/ /** - * @class Ext.grid.column.Action - * @extends Ext.grid.column.Column - *
A Grid header type which renders an icon, or a series of icons in a grid cell, and offers a scoped click - * handler for each icon.
+ * A Grid header type which renders an icon, or a series of icons in a grid cell, and offers a scoped click + * handler for each icon. * - * {@img Ext.grid.column.Action/Ext.grid.column.Action.png Ext.grid.column.Action grid column} - * - * ## Code + * @example * Ext.create('Ext.data.Store', { * storeId:'employeeStore', * fields:['firstname', 'lastname', 'senority', 'dep', 'hired'], @@ -15,10 +25,10 @@ * {firstname:"Dwight", lastname:"Schrute"}, * {firstname:"Jim", lastname:"Halpert"}, * {firstname:"Kevin", lastname:"Malone"}, - * {firstname:"Angela", lastname:"Martin"} + * {firstname:"Angela", lastname:"Martin"} * ] * }); - * + * * Ext.create('Ext.grid.Panel', { * title: 'Action Column Demo', * store: Ext.data.StoreManager.lookup('employeeStore'), @@ -26,31 +36,31 @@ * {text: 'First Name', dataIndex:'firstname'}, * {text: 'Last Name', dataIndex:'lastname'}, * { - * xtype:'actioncolumn', + * xtype:'actioncolumn', * width:50, * items: [{ - * icon: 'images/edit.png', // Use a URL in the icon config + * icon: 'extjs/examples/shared/icons/fam/cog_edit.png', // Use a URL in the icon config * tooltip: 'Edit', * handler: function(grid, rowIndex, colIndex) { * var rec = grid.getStore().getAt(rowIndex); * alert("Edit " + rec.get('firstname')); * } * },{ - * icon: 'images/delete.png', + * icon: 'extjs/examples/restful/images/delete.png', * tooltip: 'Delete', * handler: function(grid, rowIndex, colIndex) { * var rec = grid.getStore().getAt(rowIndex); * alert("Terminate " + rec.get('firstname')); - * } + * } * }] * } * ], * width: 250, * renderTo: Ext.getBody() * }); - *The action column can be at any index in the columns array, and a grid can have any number of - * action columns.
- * @xtype actioncolumn + * + * The action column can be at any index in the columns array, and a grid can have any number of + * action columns. */ Ext.define('Ext.grid.column.Action', { extend: 'Ext.grid.column.Column', @@ -59,87 +69,104 @@ Ext.define('Ext.grid.column.Action', { /** * @cfg {String} icon - * The URL of an image to display as the clickable element in the column. - * Optional - defaults to{@link Ext#BLANK_IMAGE_URL Ext.BLANK_IMAGE_URL}
.
+ * The URL of an image to display as the clickable element in the column. Defaults to
+ * `{@link Ext#BLANK_IMAGE_URL Ext.BLANK_IMAGE_URL}`.
*/
/**
* @cfg {String} iconCls
- * A CSS class to apply to the icon image. To determine the class dynamically, configure the Column with a {@link #getClass}
function.
+ * A CSS class to apply to the icon image. To determine the class dynamically, configure the Column with
+ * a `{@link #getClass}` function.
+ */
+ /**
+ * @cfg {Function} handler
+ * A function called when the icon is clicked.
+ * @cfg {Ext.view.Table} handler.view The owning TableView.
+ * @cfg {Number} handler.rowIndex The row index clicked on.
+ * @cfg {Number} handler.colIndex The column index clicked on.
+ * @cfg {Object} handler.item The clicked item (or this Column if multiple {@link #items} were not configured).
+ * @cfg {Event} handler.e The click event.
*/
/**
- * @cfg {Function} handler A function called when the icon is clicked.
- * The handler is passed the following parameters:view
: TableViewrowIndex
: NumbercolIndex
: Numberitem
: Objecte
: Event{@link #handler}
- * and {@link #getClass}
fuctions are executed. Defaults to this Column.
+ * @cfg {String} tooltip
+ * A tooltip message to be displayed on hover. {@link Ext.tip.QuickTipManager#init Ext.tip.QuickTipManager} must
+ * have been initialized.
+ */
+ /* @cfg {Boolean} disabled
+ * If true, the action will not respond to click events, and will be displayed semi-opaque.
*/
/**
- * @cfg {String} tooltip A tooltip message to be displayed on hover. {@link Ext.tip.QuickTipManager#init Ext.tip.QuickTipManager} must have
- * been initialized.
+ * @cfg {Boolean} [stopSelection=true]
+ * Prevent grid _row_ selection upon mousedown.
*/
/**
- * @cfg {Boolean} stopSelection Defaults to true
. Prevent grid row selection upon mousedown.
+ * @cfg {Function} getClass
+ * A function which returns the CSS class to apply to the icon image.
+ *
+ * @cfg {Object} getClass.v The value of the column's configured field (if any).
+ *
+ * @cfg {Object} getClass.metadata An object in which you may set the following attributes:
+ * @cfg {String} getClass.metadata.css A CSS class name to add to the cell's TD element.
+ * @cfg {String} getClass.metadata.attr An HTML attribute definition string to apply to the data container
+ * element *within* the table cell (e.g. 'style="color:red;"').
+ *
+ * @cfg {Ext.data.Model} getClass.r The Record providing the data.
+ *
+ * @cfg {Number} getClass.rowIndex The row index..
+ *
+ * @cfg {Number} getClass.colIndex The column index.
+ *
+ * @cfg {Ext.data.Store} getClass.store The Store which is providing the data Model.
*/
/**
- * @cfg {Function} getClass A function which returns the CSS class to apply to the icon image.
- * The function is passed the following parameters:The value of the column's configured field (if any).
An object in which you may set the following attributes:
A CSS class name to add to the cell's TD element.
An HTML attribute definition string to apply to the data container element within the table cell - * (e.g. 'style="color:red;"').
The Record providing the data.
The row index..
The column index.
The Store which is providing the data Model.
icon
: StringiconCls
: StringgetClass
function.getClass
: FunctionThe value of the column's configured field (if any).
An object in which you may set the following attributes:
A CSS class name to add to the cell's TD element.
An HTML attribute definition string to apply to the data container element within the table cell - * (e.g. 'style="color:red;"').
The Record providing the data.
The row index..
The column index.
The Store which is providing the data Model.
handler
: Functionscope
: Scopethis
reference) in which the
- * handler
and getClass
functions are executed. Fallback defaults are this Column's
- * configured scope, then this Column.tooltip
: String