2 * @class Ext.grid.feature.Feature
3 * @extends Ext.util.Observable
5 * A feature is a type of plugin that is specific to the {@link Ext.grid.Panel}. It provides several
6 * hooks that allows the developer to inject additional functionality at certain points throughout the
7 * grid creation cycle. This class provides the base template methods that are available to the developer,
8 * it should be extended.
10 * There are several built in features that extend this class, for example:
12 * - {@link Ext.grid.feature.Grouping} - Shows grid rows in groups as specified by the {@link Ext.data.Store}
13 * - {@link Ext.grid.feature.RowBody} - Adds a body section for each grid row that can contain markup.
14 * - {@link Ext.grid.feature.Summary} - Adds a summary row at the bottom of the grid with aggregate totals for a column.
17 * A feature is added to the grid by specifying it an array of features in the configuration:
19 * var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
20 * Ext.create('Ext.grid.Panel', {
22 * features: [groupingFeature]
27 Ext.define('Ext.grid.feature.Feature', {
28 extend: 'Ext.util.Observable',
29 alias: 'feature.feature',
36 * Most features will expose additional events, some may not and will
37 * need to change this to false.
39 hasFeatureEvent: true,
43 * Prefix to use when firing events on the view.
44 * For example a prefix of group would expose "groupclick", "groupcontextmenu", "groupdblclick".
50 * Selector used to determine when to fire the event with the eventPrefix.
55 * @property {Ext.view.Table}
56 * Reference to the TableView.
61 * @property {Ext.grid.Panel}
62 * Reference to the grid panel
67 * Most features will not modify the data returned to the view.
68 * This is limited to one feature that manipulates the data per grid view.
72 getFeatureTpl: function() {
77 * Abstract method to be overriden when a feature should add additional
78 * arguments to its event signature. By default the event will fire:
79 * - view - The underlying Ext.view.Table
80 * - featureTarget - The matched element by the defined {@link eventSelector}
82 * The method must also return the eventName as the first index of the array
83 * to be passed to fireEvent.
85 getFireEventArgs: function(eventName, view, featureTarget) {
86 return [eventName, view, featureTarget];
90 * Approriate place to attach events to the view, selectionmodel, headerCt, etc
92 attachEvents: function() {
96 getFragmentTpl: function() {
101 * Allows a feature to mutate the metaRowTpl.
102 * The array received as a single argument can be manipulated to add things
103 * on the end/begining of a particular row.
105 mutateMetaRowTpl: function(metaRowTplArray) {
110 * Allows a feature to inject member methods into the metaRowTpl. This is
111 * important for embedding functionality which will become part of the proper
114 getMetaRowTplFragments: function() {
118 getTableFragments: function() {
123 * Provide additional data to the prepareData call within the grid view.
124 * @param {Object} data The data for this particular record.
125 * @param {Number} idx The row index for this record.
126 * @param {Ext.data.Model} record The record instance
127 * @param {Object} orig The original result from the prepareData call to massage.
129 getAdditionalData: function(data, idx, record, orig) {
137 this.disabled = false;
143 disable: function() {
144 this.disabled = true;