1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-grid.feature.Feature'>/**
2 </span> * @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',
34 <span id='Ext-grid.feature.Feature-property-hasFeatureEvent'> /**
35 </span> * @property {Boolean}
36 * Most features will expose additional events, some may not and will
37 * need to change this to false.
39 hasFeatureEvent: true,
41 <span id='Ext-grid.feature.Feature-property-eventPrefix'> /**
42 </span> * @property {String}
43 * Prefix to use when firing events on the view.
44 * For example a prefix of group would expose "groupclick", "groupcontextmenu", "groupdblclick".
48 <span id='Ext-grid.feature.Feature-property-eventSelector'> /**
49 </span> * @property {String}
50 * Selector used to determine when to fire the event with the eventPrefix.
54 <span id='Ext-grid.feature.Feature-property-view'> /**
55 </span> * @property {Ext.view.Table}
56 * Reference to the TableView.
60 <span id='Ext-grid.feature.Feature-property-grid'> /**
61 </span> * @property {Ext.grid.Panel}
62 * Reference to the grid panel
66 <span id='Ext-grid.feature.Feature-property-collectData'> /**
67 </span> * 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() {
76 <span id='Ext-grid.feature.Feature-method-getFireEventArgs'> /**
77 </span> * 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];
89 <span id='Ext-grid.feature.Feature-method-attachEvents'> /**
90 </span> * Approriate place to attach events to the view, selectionmodel, headerCt, etc
92 attachEvents: function() {
96 getFragmentTpl: function() {
100 <span id='Ext-grid.feature.Feature-method-mutateMetaRowTpl'> /**
101 </span> * 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) {
109 <span id='Ext-grid.feature.Feature-method-getMetaRowTplFragments'> /**
110 </span> * 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() {
122 <span id='Ext-grid.feature.Feature-method-getAdditionalData'> /**
123 </span> * 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) {
133 <span id='Ext-grid.feature.Feature-method-enable'> /**
134 </span> * Enable a feature
137 this.disabled = false;
140 <span id='Ext-grid.feature.Feature-method-disable'> /**
141 </span> * Disable a feature
143 disable: function() {
144 this.disabled = true;
147 });</pre></pre></body></html>