3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 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.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.grid.feature.Feature
17 * @extends Ext.util.Observable
19 * A feature is a type of plugin that is specific to the {@link Ext.grid.Panel}. It provides several
20 * hooks that allows the developer to inject additional functionality at certain points throughout the
21 * grid creation cycle. This class provides the base template methods that are available to the developer,
22 * it should be extended.
24 * There are several built in features that extend this class, for example:
26 * - {@link Ext.grid.feature.Grouping} - Shows grid rows in groups as specified by the {@link Ext.data.Store}
27 * - {@link Ext.grid.feature.RowBody} - Adds a body section for each grid row that can contain markup.
28 * - {@link Ext.grid.feature.Summary} - Adds a summary row at the bottom of the grid with aggregate totals for a column.
31 * A feature is added to the grid by specifying it an array of features in the configuration:
33 * var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
34 * Ext.create('Ext.grid.Panel', {
36 * features: [groupingFeature]
41 Ext.define('Ext.grid.feature.Feature', {
42 extend: 'Ext.util.Observable',
43 alias: 'feature.feature',
50 * Most features will expose additional events, some may not and will
51 * need to change this to false.
53 hasFeatureEvent: true,
57 * Prefix to use when firing events on the view.
58 * For example a prefix of group would expose "groupclick", "groupcontextmenu", "groupdblclick".
64 * Selector used to determine when to fire the event with the eventPrefix.
69 * @property {Ext.view.Table}
70 * Reference to the TableView.
75 * @property {Ext.grid.Panel}
76 * Reference to the grid panel
81 * Most features will not modify the data returned to the view.
82 * This is limited to one feature that manipulates the data per grid view.
86 getFeatureTpl: function() {
91 * Abstract method to be overriden when a feature should add additional
92 * arguments to its event signature. By default the event will fire:
93 * - view - The underlying Ext.view.Table
94 * - featureTarget - The matched element by the defined {@link #eventSelector}
96 * The method must also return the eventName as the first index of the array
97 * to be passed to fireEvent.
100 getFireEventArgs: function(eventName, view, featureTarget, e) {
101 return [eventName, view, featureTarget, e];
105 * Approriate place to attach events to the view, selectionmodel, headerCt, etc
108 attachEvents: function() {
112 getFragmentTpl: function() {
117 * Allows a feature to mutate the metaRowTpl.
118 * The array received as a single argument can be manipulated to add things
119 * on the end/begining of a particular row.
122 mutateMetaRowTpl: function(metaRowTplArray) {
127 * Allows a feature to inject member methods into the metaRowTpl. This is
128 * important for embedding functionality which will become part of the proper
132 getMetaRowTplFragments: function() {
136 getTableFragments: function() {
141 * Provide additional data to the prepareData call within the grid view.
142 * @param {Object} data The data for this particular record.
143 * @param {Number} idx The row index for this record.
144 * @param {Ext.data.Model} record The record instance
145 * @param {Object} orig The original result from the prepareData call to massage.
148 getAdditionalData: function(data, idx, record, orig) {
156 this.disabled = false;
162 disable: function() {
163 this.disabled = true;