4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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-RowBody'>/**
19 </span> * @class Ext.grid.feature.RowBody
20 * @extends Ext.grid.feature.Feature
22 * The rowbody feature enhances the grid's markup to have an additional
23 * tr -> td -> div which spans the entire width of the original row.
25 * This is useful to to associate additional information with a particular
28 * Rowbodies are initially hidden unless you override getAdditionalData.
30 * Will expose additional events on the gridview with the prefix of 'rowbody'.
31 * For example: 'rowbodyclick', 'rowbodydblclick', 'rowbodycontextmenu'.
35 Ext.define('Ext.grid.feature.RowBody', {
36 extend: 'Ext.grid.feature.Feature',
37 alias: 'feature.rowbody',
38 rowBodyHiddenCls: Ext.baseCSSPrefix + 'grid-row-body-hidden',
39 rowBodyTrCls: Ext.baseCSSPrefix + 'grid-rowbody-tr',
40 rowBodyTdCls: Ext.baseCSSPrefix + 'grid-cell-rowbody',
41 rowBodyDivCls: Ext.baseCSSPrefix + 'grid-rowbody',
43 eventPrefix: 'rowbody',
44 eventSelector: '.' + Ext.baseCSSPrefix + 'grid-rowbody-tr',
46 getRowBody: function(values) {
48 '<tr class="' + this.rowBodyTrCls + ' {rowBodyCls}">',
49 '<td class="' + this.rowBodyTdCls + '" colspan="{rowBodyColspan}">',
50 '<div class="' + this.rowBodyDivCls + '">{rowBody}</div>',
56 // injects getRowBody into the metaRowTpl.
57 getMetaRowTplFragments: function() {
59 getRowBody: this.getRowBody,
60 rowBodyTrCls: this.rowBodyTrCls,
61 rowBodyTdCls: this.rowBodyTdCls,
62 rowBodyDivCls: this.rowBodyDivCls
66 mutateMetaRowTpl: function(metaRowTpl) {
67 metaRowTpl.push('{[this.getRowBody(values)]}');
70 <span id='Ext-grid-feature-RowBody-method-getAdditionalData'> /**
71 </span> * Provide additional data to the prepareData call within the grid view.
72 * The rowbody feature adds 3 additional variables into the grid view's template.
73 * These are rowBodyCls, rowBodyColspan, and rowBody.
74 * @param {Object} data The data for this particular record.
75 * @param {Number} idx The row index for this record.
76 * @param {Ext.data.Model} record The record instance
77 * @param {Object} orig The original result from the prepareData call to massage.
79 getAdditionalData: function(data, idx, record, orig) {
80 var headerCt = this.view.headerCt,
81 colspan = headerCt.getColumnCount();
84 rowBody: "",
85 rowBodyCls: this.rowBodyCls,
86 rowBodyColspan: colspan