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-view.TableChunker'>/**
2 </span> * @class Ext.view.TableChunker
4 * Produces optimized XTemplates for chunks of tables to be
5 * used in grids, trees and other table based widgets.
9 Ext.define('Ext.view.TableChunker', {
11 requires: ['Ext.XTemplate'],
13 '{[this.openTableWrap()]}',
14 '<table class="' + Ext.baseCSSPrefix + 'grid-table ' + Ext.baseCSSPrefix + 'grid-table-resizer" border="0" cellspacing="0" cellpadding="0" {[this.embedFullWidth()]}>',
17 '<tpl for="columns">',
18 '<th class="' + Ext.baseCSSPrefix + 'grid-col-resizer-{id}" style="width: {width}px; height: 0px;"></th>',
21 '{[this.openRows()]}',
23 '<tpl for="features">',
24 '{[this.embedFeature(values, parent, xindex, xcount)]}',
26 '{[this.closeRows()]}',
29 '{[this.closeTableWrap()]}'
32 constructor: function() {
33 Ext.XTemplate.prototype.recurse = function(values, reference) {
34 return this.apply(reference ? values[reference] : values);
38 embedFeature: function(values, parent, x, xcount) {
40 if (!values.disabled) {
41 tpl = values.getFeatureTpl(values, parent, x, xcount);
46 embedFullWidth: function() {
47 return 'style="width: {fullWidth}px;"';
50 openRows: function() {
51 return '<tpl for="rows">';
54 closeRows: function() {
55 return '</tpl>';
59 '<tr class="' + Ext.baseCSSPrefix + 'grid-row {addlSelector} {[this.embedRowCls()]}" {[this.embedRowAttr()]}>',
60 '<tpl for="columns">',
61 '<td class="{cls} ' + Ext.baseCSSPrefix + 'grid-cell ' + Ext.baseCSSPrefix + 'grid-cell-{columnId} {{id}-modified} {{id}-tdCls} {[this.firstOrLastCls(xindex, xcount)]}" {{id}-tdAttr}><div unselectable="on" class="' + Ext.baseCSSPrefix + 'grid-cell-inner ' + Ext.baseCSSPrefix + 'unselectable" style="{{id}-style}; text-align: {align};">{{id}}</div></td>',
66 firstOrLastCls: function(xindex, xcount) {
69 cssCls = Ext.baseCSSPrefix + 'grid-cell-first';
70 } else if (xindex === xcount) {
71 cssCls = Ext.baseCSSPrefix + 'grid-cell-last';
76 embedRowCls: function() {
80 embedRowAttr: function() {
84 openTableWrap: function() {
88 closeTableWrap: function() {
92 getTableTpl: function(cfg, textOnly) {
95 openRows: this.openRows,
96 closeRows: this.closeRows,
97 embedFeature: this.embedFeature,
98 embedFullWidth: this.embedFullWidth,
99 openTableWrap: this.openTableWrap,
100 closeTableWrap: this.closeTableWrap
103 features = cfg.features || [],
104 ln = features.length,
107 embedRowCls: this.embedRowCls,
108 embedRowAttr: this.embedRowAttr,
109 firstOrLastCls: this.firstOrLastCls
112 metaRowTpl = Array.prototype.slice.call(this.metaRowTpl, 0),
115 for (; i < ln; i++) {
116 if (!features[i].disabled) {
117 features[i].mutateMetaRowTpl(metaRowTpl);
118 Ext.apply(memberFns, features[i].getMetaRowTplFragments());
119 Ext.apply(tplMemberFns, features[i].getFragmentTpl());
120 Ext.apply(tableTplMemberFns, features[i].getTableFragments());
124 metaRowTpl = Ext.create('Ext.XTemplate', metaRowTpl.join(''), memberFns);
125 cfg.row = metaRowTpl.applyTemplate(cfg);
127 metaTableTpl = Ext.create('Ext.XTemplate', this.metaTableTpl.join(''), tableTplMemberFns);
129 tpl = metaTableTpl.applyTemplate(cfg);
131 // TODO: Investigate eliminating.
133 tpl = Ext.create('Ext.XTemplate', tpl, tplMemberFns);
139 </pre></pre></body></html>