4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-feature-Feature'>/**
19 </span> * @class Ext.grid.feature.Feature
20 * @extends Ext.util.Observable
22 * A feature is a type of plugin that is specific to the {@link Ext.grid.Panel}. It provides several
23 * hooks that allows the developer to inject additional functionality at certain points throughout the
24 * grid creation cycle. This class provides the base template methods that are available to the developer,
25 * it should be extended.
27 * There are several built in features that extend this class, for example:
29 * - {@link Ext.grid.feature.Grouping} - Shows grid rows in groups as specified by the {@link Ext.data.Store}
30 * - {@link Ext.grid.feature.RowBody} - Adds a body section for each grid row that can contain markup.
31 * - {@link Ext.grid.feature.Summary} - Adds a summary row at the bottom of the grid with aggregate totals for a column.
34 * A feature is added to the grid by specifying it an array of features in the configuration:
36 * var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
37 * Ext.create('Ext.grid.Panel', {
39 * features: [groupingFeature]
44 Ext.define('Ext.grid.feature.Feature', {
45 extend: 'Ext.util.Observable',
46 alias: 'feature.feature',
51 <span id='Ext-grid-feature-Feature-property-hasFeatureEvent'> /**
52 </span> * @property {Boolean}
53 * Most features will expose additional events, some may not and will
54 * need to change this to false.
56 hasFeatureEvent: true,
58 <span id='Ext-grid-feature-Feature-property-eventPrefix'> /**
59 </span> * @property {String}
60 * Prefix to use when firing events on the view.
61 * For example a prefix of group would expose "groupclick", "groupcontextmenu", "groupdblclick".
65 <span id='Ext-grid-feature-Feature-property-eventSelector'> /**
66 </span> * @property {String}
67 * Selector used to determine when to fire the event with the eventPrefix.
71 <span id='Ext-grid-feature-Feature-property-view'> /**
72 </span> * @property {Ext.view.Table}
73 * Reference to the TableView.
77 <span id='Ext-grid-feature-Feature-property-grid'> /**
78 </span> * @property {Ext.grid.Panel}
79 * Reference to the grid panel
83 <span id='Ext-grid-feature-Feature-property-collectData'> /**
84 </span> * Most features will not modify the data returned to the view.
85 * This is limited to one feature that manipulates the data per grid view.
89 getFeatureTpl: function() {
93 <span id='Ext-grid-feature-Feature-method-getFireEventArgs'> /**
94 </span> * Abstract method to be overriden when a feature should add additional
95 * arguments to its event signature. By default the event will fire:
96 * - view - The underlying Ext.view.Table
97 * - featureTarget - The matched element by the defined {@link eventSelector}
99 * The method must also return the eventName as the first index of the array
100 * to be passed to fireEvent.
102 getFireEventArgs: function(eventName, view, featureTarget, e) {
103 return [eventName, view, featureTarget, e];
106 <span id='Ext-grid-feature-Feature-method-attachEvents'> /**
107 </span> * Approriate place to attach events to the view, selectionmodel, headerCt, etc
109 attachEvents: function() {
113 getFragmentTpl: function() {
117 <span id='Ext-grid-feature-Feature-method-mutateMetaRowTpl'> /**
118 </span> * Allows a feature to mutate the metaRowTpl.
119 * The array received as a single argument can be manipulated to add things
120 * on the end/begining of a particular row.
122 mutateMetaRowTpl: function(metaRowTplArray) {
126 <span id='Ext-grid-feature-Feature-method-getMetaRowTplFragments'> /**
127 </span> * Allows a feature to inject member methods into the metaRowTpl. This is
128 * important for embedding functionality which will become part of the proper
131 getMetaRowTplFragments: function() {
135 getTableFragments: function() {
139 <span id='Ext-grid-feature-Feature-method-getAdditionalData'> /**
140 </span> * Provide additional data to the prepareData call within the grid view.
141 * @param {Object} data The data for this particular record.
142 * @param {Number} idx The row index for this record.
143 * @param {Ext.data.Model} record The record instance
144 * @param {Object} orig The original result from the prepareData call to massage.
146 getAdditionalData: function(data, idx, record, orig) {
150 <span id='Ext-grid-feature-Feature-method-enable'> /**
151 </span> * Enable a feature
154 this.disabled = false;
157 <span id='Ext-grid-feature-Feature-method-disable'> /**
158 </span> * Disable a feature
160 disable: function() {
161 this.disabled = true;