2 |
aperonnet |
1 |
<div class="body-wrap">
|
|
|
2 |
<div class="top-tools">
|
|
|
3 |
<a class="inner-link" href="#Ext.XTemplate-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
|
|
|
4 |
<a class="inner-link" href="#Ext.XTemplate-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
|
|
|
5 |
<a class="inner-link" href="#Ext.XTemplate-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
|
|
|
6 |
<a class="bookmark" href="../docs/?class=Ext.XTemplate"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
|
|
|
7 |
</div>
|
|
|
8 |
<div class="inheritance res-block">
|
|
|
9 |
<pre class="res-block-inner"><a ext:cls="Ext.Template" ext:member="" href="output/Ext.Template.html">Template</a>
|
|
|
10 |
<img src="resources/elbow-end.gif"/>XTemplate</pre></div>
|
|
|
11 |
<h1>Class Ext.XTemplate</h1>
|
|
|
12 |
<table cellspacing="0">
|
|
|
13 |
<tr><td class="label">Package:</td><td class="hd-info">Ext</td></tr>
|
|
|
14 |
<tr><td class="label">Defined In:</td><td class="hd-info"><a href="../source/util/XTemplate.js" target="_blank">XTemplate.js</a></td></tr>
|
|
|
15 |
<tr><td class="label">Class:</td><td class="hd-info">XTemplate</td></tr>
|
|
|
16 |
<tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.Template" ext:member="" href="output/Ext.Template.html">Template</a></td></tr>
|
|
|
17 |
</table>
|
|
|
18 |
<div class="description">
|
|
|
19 |
<p>A template class that supports advanced functionality like autofilling arrays, conditional processing with
|
|
|
20 |
basic comparison operators, sub-templates, basic math function support, special built-in template variables,
|
|
|
21 |
inline code execution and more. XTemplate also provides the templating mechanism built into <a ext:cls="Ext.DataView" href="output/Ext.DataView.html">Ext.DataView</a>.</p>
|
|
|
22 |
<p>XTemplate supports many special tags and built-in operators that aren't defined as part of the API, but are
|
|
|
23 |
supported in the templates that can be created. The following examples demonstrate all of the supported features.
|
|
|
24 |
This is the data object used for reference in each code example:</p>
|
|
|
25 |
<pre><code>var data = {
|
|
|
26 |
name: <em>'Jack Slocum'</em>,
|
|
|
27 |
title: <em>'Lead Developer'</em>,
|
|
|
28 |
company: <em>'Ext JS, LLC'</em>,
|
|
|
29 |
email: <em>'jack@extjs.com'</em>,
|
|
|
30 |
address: <em>'4 Red Bulls Drive'</em>,
|
|
|
31 |
city: <em>'Cleveland'</em>,
|
|
|
32 |
state: <em>'Ohio'</em>,
|
|
|
33 |
zip: <em>'44102'</em>,
|
|
|
34 |
drinks: [<em>'Red Bull'</em>, <em>'Coffee'</em>, <em>'Water'</em>],
|
|
|
35 |
kids: [{
|
|
|
36 |
name: <em>'Sara Grace'</em>,
|
|
|
37 |
age:3
|
|
|
38 |
},{
|
|
|
39 |
name: <em>'Zachary'</em>,
|
|
|
40 |
age:2
|
|
|
41 |
},{
|
|
|
42 |
name: <em>'John James'</em>,
|
|
|
43 |
age:0
|
|
|
44 |
}]
|
|
|
45 |
};</code></pre>
|
|
|
46 |
<p><b>Auto filling of arrays and scope switching</b><br/>Using the <tt>tpl</tt> tag and the <tt>for</tt> operator,
|
|
|
47 |
you can switch to the scope of the object specified by <tt>for</tt> and access its members to populate the teamplte.
|
|
|
48 |
If the variable in <tt>for</tt> is an array, it will auto-fill, repeating the template block inside the <tt>tpl</tt>
|
|
|
49 |
tag for each item in the array:</p>
|
|
|
50 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
51 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
52 |
<em>'<p>Title: {title}</p>'</em>,
|
|
|
53 |
<em>'<p>Company: {company}</p>'</em>,
|
|
|
54 |
<em>'<p>Kids: '</em>,
|
|
|
55 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
56 |
<em>'<p>{name}</p>'</em>,
|
|
|
57 |
<em>'</tpl></p>'</em>
|
|
|
58 |
);
|
|
|
59 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
60 |
<p><b>Access to parent object from within sub-template scope</b><br/>When processing a sub-template, for example while
|
|
|
61 |
looping through a child array, you can access the parent object's members via the <tt>parent</tt> object:</p>
|
|
|
62 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
63 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
64 |
<em>'<p>Kids: '</em>,
|
|
|
65 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
66 |
<em>'<tpl <b>if</b>="age > 1">'</em>,
|
|
|
67 |
<em>'<p>{name}</p>'</em>,
|
|
|
68 |
<em>'<p>Dad: {parent.name}</p>'</em>,
|
|
|
69 |
<em>'</tpl>'</em>,
|
|
|
70 |
<em>'</tpl></p>'</em>
|
|
|
71 |
);
|
|
|
72 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
73 |
<p><b>Array item index and basic math support</b> <br/>While processing an array, the special variable <tt>{#}</tt>
|
|
|
74 |
will provide the current array index + 1 (starts at 1, not 0). Templates also support the basic math operators
|
|
|
75 |
+ - * and / that can be applied directly on numeric data values:</p>
|
|
|
76 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
77 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
78 |
<em>'<p>Kids: '</em>,
|
|
|
79 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
80 |
<em>'<tpl <b>if</b>="age > 1">'</em>,
|
|
|
81 |
<em>'<p>{#}: {name}</p>'</em>, <i>// <-- Auto-number each item</i>
|
|
|
82 |
<em>'<p>In 5 Years: {age+5}</p>'</em>, <i>// <-- Basic math</i>
|
|
|
83 |
<em>'<p>Dad: {parent.name}</p>'</em>,
|
|
|
84 |
<em>'</tpl>'</em>,
|
|
|
85 |
<em>'</tpl></p>'</em>
|
|
|
86 |
);
|
|
|
87 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
88 |
<p><b>Auto-rendering of flat arrays</b> <br/>Flat arrays that contain values (and not objects) can be auto-rendered
|
|
|
89 |
using the special <tt>{.}</tt> variable inside a loop. This variable will represent the value of
|
|
|
90 |
the array at the current index:</p>
|
|
|
91 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
92 |
<em>'<p>{name}\'</em>s favorite beverages:</p>',
|
|
|
93 |
<em>'<tpl <b>for</b>="drinks">'</em>,
|
|
|
94 |
<em>'<div> - {.}</div>'</em>,
|
|
|
95 |
<em>'</tpl>'</em>
|
|
|
96 |
);
|
|
|
97 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
98 |
<p><b>Basic conditional logic</b> <br/>Using the <tt>tpl</tt> tag and the <tt>if</tt>
|
|
|
99 |
operator you can provide conditional checks for deciding whether or not to render specific parts of the template.
|
|
|
100 |
Note that there is no <tt>else</tt> operator — if needed, you should use two opposite <tt>if</tt> statements.
|
|
|
101 |
Properly-encoded attributes are required as seen in the following example:</p>
|
|
|
102 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
103 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
104 |
<em>'<p>Kids: '</em>,
|
|
|
105 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
106 |
<em>'<tpl <b>if</b>="age &gt; 1">'</em>, <i>// <-- Note that the > is encoded</i>
|
|
|
107 |
<em>'<p>{name}</p>'</em>,
|
|
|
108 |
<em>'</tpl>'</em>,
|
|
|
109 |
<em>'</tpl></p>'</em>
|
|
|
110 |
);
|
|
|
111 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
112 |
<p><b>Ability to execute arbitrary inline code</b> <br/>In an XTemplate, anything between {[ ... ]} is considered
|
|
|
113 |
code to be executed in the scope of the template. There are some special variables available in that code:
|
|
|
114 |
<ul>
|
|
|
115 |
<li><b><tt>values</tt></b>: The values in the current scope. If you are using scope changing sub-templates, you
|
|
|
116 |
can change what <tt>values</tt> is.</li>
|
|
|
117 |
<li><b><tt>parent</tt></b>: The scope (values) of the ancestor template.</li>
|
|
|
118 |
<li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the loop you are in (1-based).</li>
|
|
|
119 |
<li><b><tt>xcount</tt></b>: If you are in a looping template, the total length of the array you are looping.</li>
|
|
|
120 |
<li><b><tt>fm</tt></b>: An alias for <tt>Ext.util.Format</tt>.</li>
|
|
|
121 |
</ul>
|
|
|
122 |
This example demonstrates basic row striping using an inline code block and the <tt>xindex</tt> variable:</p>
|
|
|
123 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
124 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
125 |
<em>'<p>Company: {[company.toUpperCase() + '</em>, <em>' + title]}</p>'</em>,
|
|
|
126 |
<em>'<p>Kids: '</em>,
|
|
|
127 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
128 |
'<div class=<em>"{[xindex % 2 === 0 ? "</em>even<em>" : "</em>odd<em>"]}"</em>>,
|
|
|
129 |
<em>'{name}'</em>,
|
|
|
130 |
<em>'</div>'</em>,
|
|
|
131 |
<em>'</tpl></p>'</em>
|
|
|
132 |
);
|
|
|
133 |
tpl.overwrite(panel.body, data);</code></pre>
|
|
|
134 |
<p><b>Template member functions</b> <br/>One or more member functions can be defined directly on the config
|
|
|
135 |
object passed into the XTemplate constructor for more complex processing:</p>
|
|
|
136 |
<pre><code>var tpl = <b>new</b> Ext.XTemplate(
|
|
|
137 |
<em>'<p>Name: {name}</p>'</em>,
|
|
|
138 |
<em>'<p>Kids: '</em>,
|
|
|
139 |
<em>'<tpl <b>for</b>="kids">'</em>,
|
|
|
140 |
<em>'<tpl <b>if</b>="<b>this</b>.isGirl(name)">'</em>,
|
|
|
141 |
<em>'<p>Girl: {name} - {age}</p>'</em>,
|
|
|
142 |
<em>'</tpl>'</em>,
|
|
|
143 |
<em>'<tpl <b>if</b>="<b>this</b>.isGirl(name) == false">'</em>,
|
|
|
144 |
<em>'<p>Boy: {name} - {age}</p>'</em>,
|
|
|
145 |
<em>'</tpl>'</em>,
|
|
|
146 |
<em>'<tpl <b>if</b>="<b>this</b>.isBaby(age)">'</em>,
|
|
|
147 |
<em>'<p>{name} is a baby!</p>'</em>,
|
|
|
148 |
<em>'</tpl>'</em>,
|
|
|
149 |
<em>'</tpl></p>'</em>, {
|
|
|
150 |
isGirl: <b>function</b>(name){
|
|
|
151 |
<b>return</b> name == <em>'Sara Grace'</em>;
|
|
|
152 |
},
|
|
|
153 |
isBaby: <b>function</b>(age){
|
|
|
154 |
<b>return</b> age < 1;
|
|
|
155 |
}
|
|
|
156 |
});
|
|
|
157 |
tpl.overwrite(panel.body, data);</code></pre> </div>
|
|
|
158 |
|
|
|
159 |
<div class="hr"></div>
|
|
|
160 |
<a id="Ext.XTemplate-props"></a>
|
|
|
161 |
<h2>Public Properties</h2>
|
|
|
162 |
<div class="no-members">This class has no public properties.</div> <a id="Ext.XTemplate-methods"></a>
|
|
|
163 |
<h2>Public Methods</h2>
|
|
|
164 |
<table cellspacing="0" class="member-table">
|
|
|
165 |
<tr>
|
|
|
166 |
<th class="sig-header" colspan="2">Method</th>
|
|
|
167 |
<th class="msource-header">Defined By</th>
|
|
|
168 |
</tr>
|
|
|
169 |
<tr class="method-row expandable">
|
|
|
170 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
171 |
<td class="sig">
|
|
|
172 |
<a id="Ext.XTemplate-XTemplate"></a>
|
|
|
173 |
<b>XTemplate</b>( <code>String/Array/Object parts</code> ) <div class="mdesc">
|
|
|
174 |
<div class="short"></div>
|
|
|
175 |
<div class="long">
|
|
|
176 |
<div class="mdetail-params">
|
|
|
177 |
<strong>Parameters:</strong>
|
|
|
178 |
<ul><li><code>parts</code> : String/Array/Object<div class="sub-desc">The HTML fragment or an array of fragments to join(""), or multiple arguments
|
|
|
179 |
to join("") that can also include a config object</div></li> </ul>
|
|
|
180 |
<strong>Returns:</strong>
|
|
|
181 |
<ul>
|
|
|
182 |
<li><code></code></li>
|
|
|
183 |
</ul>
|
|
|
184 |
</div>
|
|
|
185 |
</div>
|
|
|
186 |
</div>
|
|
|
187 |
</td>
|
|
|
188 |
<td class="msource">XTemplate</td>
|
|
|
189 |
</tr>
|
|
|
190 |
<tr class="method-row alt expandable">
|
|
|
191 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
192 |
<td class="sig">
|
|
|
193 |
<a id="Ext.XTemplate-XTemplate.from"></a>
|
|
|
194 |
<b>XTemplate.from</b>( <code>String/HTMLElement el</code> ) : Ext.Template <div class="mdesc">
|
|
|
195 |
<div class="short"><static> Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.</div>
|
|
|
196 |
<div class="long">
|
|
|
197 |
<static> Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML. <div class="mdetail-params">
|
|
|
198 |
<strong>Parameters:</strong>
|
|
|
199 |
<ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">A DOM element or its id</div></li> </ul>
|
|
|
200 |
<strong>Returns:</strong>
|
|
|
201 |
<ul>
|
|
|
202 |
<li><code>Ext.Template</code><div class="sub-desc">The created template</div></li>
|
|
|
203 |
</ul>
|
|
|
204 |
</div>
|
|
|
205 |
</div>
|
|
|
206 |
</div>
|
|
|
207 |
</td>
|
|
|
208 |
<td class="msource">XTemplate</td>
|
|
|
209 |
</tr>
|
|
|
210 |
<tr class="method-row inherited expandable">
|
|
|
211 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
212 |
<td class="sig">
|
|
|
213 |
<a id="Ext.XTemplate-append"></a>
|
|
|
214 |
<b>append</b>( <code>Mixed el</code>, <code>Object/Array values</code>, <span class="optional" title="Optional">[<code>Boolean returnElement</code>]</span> ) : HTMLElement/Ext.Element <div class="mdesc">
|
|
|
215 |
<div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div>
|
|
|
216 |
<div class="long">
|
|
|
217 |
Applies the supplied values to the template and appends the new node(s) to el. <div class="mdetail-params">
|
|
|
218 |
<strong>Parameters:</strong>
|
|
|
219 |
<ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li> </ul>
|
|
|
220 |
<strong>Returns:</strong>
|
|
|
221 |
<ul>
|
|
|
222 |
<li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li>
|
|
|
223 |
</ul>
|
|
|
224 |
</div>
|
|
|
225 |
</div>
|
|
|
226 |
</div>
|
|
|
227 |
</td>
|
|
|
228 |
<td class="msource"><a ext:cls="Ext.Template" ext:member="#append" href="output/Ext.Template.html#append">Template</a></td>
|
|
|
229 |
</tr>
|
|
|
230 |
<tr class="method-row alt expandable">
|
|
|
231 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
232 |
<td class="sig">
|
|
|
233 |
<a id="Ext.XTemplate-apply"></a>
|
|
|
234 |
<b>apply</b>() : void <div class="mdesc">
|
|
|
235 |
<div class="short">Alias of <a ext:cls="Ext.XTemplate" ext:member="applyTemplate" href="output/Ext.XTemplate.html#applyTemplate">applyTemplate</a>.</div>
|
|
|
236 |
<div class="long">
|
|
|
237 |
Alias of <a ext:cls="Ext.XTemplate" ext:member="applyTemplate" href="output/Ext.XTemplate.html#applyTemplate">applyTemplate</a>. <div class="mdetail-params">
|
|
|
238 |
<strong>Parameters:</strong>
|
|
|
239 |
<ul><li>None.</li> </ul>
|
|
|
240 |
<strong>Returns:</strong>
|
|
|
241 |
<ul>
|
|
|
242 |
<li><code>void</code></li>
|
|
|
243 |
</ul>
|
|
|
244 |
</div>
|
|
|
245 |
</div>
|
|
|
246 |
</div>
|
|
|
247 |
</td>
|
|
|
248 |
<td class="msource">XTemplate</td>
|
|
|
249 |
</tr>
|
|
|
250 |
<tr class="method-row expandable">
|
|
|
251 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
252 |
<td class="sig">
|
|
|
253 |
<a id="Ext.XTemplate-applyTemplate"></a>
|
|
|
254 |
<b>applyTemplate</b>( <code>Object values</code> ) : String <div class="mdesc">
|
|
|
255 |
<div class="short">Returns an HTML fragment of this template with the specified values applied.</div>
|
|
|
256 |
<div class="long">
|
|
|
257 |
Returns an HTML fragment of this template with the specified values applied. <div class="mdetail-params">
|
|
|
258 |
<strong>Parameters:</strong>
|
|
|
259 |
<ul><li><code>values</code> : Object<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li> </ul>
|
|
|
260 |
<strong>Returns:</strong>
|
|
|
261 |
<ul>
|
|
|
262 |
<li><code>String</code><div class="sub-desc">The HTML fragment</div></li>
|
|
|
263 |
</ul>
|
|
|
264 |
</div>
|
|
|
265 |
</div>
|
|
|
266 |
</div>
|
|
|
267 |
</td>
|
|
|
268 |
<td class="msource">XTemplate</td>
|
|
|
269 |
</tr>
|
|
|
270 |
<tr class="method-row alt expandable">
|
|
|
271 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
272 |
<td class="sig">
|
|
|
273 |
<a id="Ext.XTemplate-compile"></a>
|
|
|
274 |
<b>compile</b>() : Function <div class="mdesc">
|
|
|
275 |
<div class="short">Compile the template to a function for optimized performance. Recommended if the template will be used frequently.</div>
|
|
|
276 |
<div class="long">
|
|
|
277 |
Compile the template to a function for optimized performance. Recommended if the template will be used frequently. <div class="mdetail-params">
|
|
|
278 |
<strong>Parameters:</strong>
|
|
|
279 |
<ul><li>None.</li> </ul>
|
|
|
280 |
<strong>Returns:</strong>
|
|
|
281 |
<ul>
|
|
|
282 |
<li><code>Function</code><div class="sub-desc">The compiled function</div></li>
|
|
|
283 |
</ul>
|
|
|
284 |
</div>
|
|
|
285 |
</div>
|
|
|
286 |
</div>
|
|
|
287 |
</td>
|
|
|
288 |
<td class="msource">XTemplate</td>
|
|
|
289 |
</tr>
|
|
|
290 |
<tr class="method-row inherited expandable">
|
|
|
291 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
292 |
<td class="sig">
|
|
|
293 |
<a id="Ext.XTemplate-insertAfter"></a>
|
|
|
294 |
<b>insertAfter</b>( <code>Mixed el</code>, <code>Object/Array values</code>, <span class="optional" title="Optional">[<code>Boolean returnElement</code>]</span> ) : HTMLElement/Ext.Element <div class="mdesc">
|
|
|
295 |
<div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div>
|
|
|
296 |
<div class="long">
|
|
|
297 |
Applies the supplied values to the template and inserts the new node(s) after el. <div class="mdetail-params">
|
|
|
298 |
<strong>Parameters:</strong>
|
|
|
299 |
<ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li> </ul>
|
|
|
300 |
<strong>Returns:</strong>
|
|
|
301 |
<ul>
|
|
|
302 |
<li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li>
|
|
|
303 |
</ul>
|
|
|
304 |
</div>
|
|
|
305 |
</div>
|
|
|
306 |
</div>
|
|
|
307 |
</td>
|
|
|
308 |
<td class="msource"><a ext:cls="Ext.Template" ext:member="#insertAfter" href="output/Ext.Template.html#insertAfter">Template</a></td>
|
|
|
309 |
</tr>
|
|
|
310 |
<tr class="method-row inherited alt expandable">
|
|
|
311 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
312 |
<td class="sig">
|
|
|
313 |
<a id="Ext.XTemplate-insertBefore"></a>
|
|
|
314 |
<b>insertBefore</b>( <code>Mixed el</code>, <code>Object/Array values</code>, <span class="optional" title="Optional">[<code>Boolean returnElement</code>]</span> ) : HTMLElement/Ext.Element <div class="mdesc">
|
|
|
315 |
<div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div>
|
|
|
316 |
<div class="long">
|
|
|
317 |
Applies the supplied values to the template and inserts the new node(s) before el. <div class="mdetail-params">
|
|
|
318 |
<strong>Parameters:</strong>
|
|
|
319 |
<ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li> </ul>
|
|
|
320 |
<strong>Returns:</strong>
|
|
|
321 |
<ul>
|
|
|
322 |
<li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li>
|
|
|
323 |
</ul>
|
|
|
324 |
</div>
|
|
|
325 |
</div>
|
|
|
326 |
</div>
|
|
|
327 |
</td>
|
|
|
328 |
<td class="msource"><a ext:cls="Ext.Template" ext:member="#insertBefore" href="output/Ext.Template.html#insertBefore">Template</a></td>
|
|
|
329 |
</tr>
|
|
|
330 |
<tr class="method-row inherited expandable">
|
|
|
331 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
332 |
<td class="sig">
|
|
|
333 |
<a id="Ext.XTemplate-insertFirst"></a>
|
|
|
334 |
<b>insertFirst</b>( <code>Mixed el</code>, <code>Object/Array values</code>, <span class="optional" title="Optional">[<code>Boolean returnElement</code>]</span> ) : HTMLElement/Ext.Element <div class="mdesc">
|
|
|
335 |
<div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div>
|
|
|
336 |
<div class="long">
|
|
|
337 |
Applies the supplied values to the template and inserts the new node(s) as the first child of el. <div class="mdetail-params">
|
|
|
338 |
<strong>Parameters:</strong>
|
|
|
339 |
<ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li> </ul>
|
|
|
340 |
<strong>Returns:</strong>
|
|
|
341 |
<ul>
|
|
|
342 |
<li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li>
|
|
|
343 |
</ul>
|
|
|
344 |
</div>
|
|
|
345 |
</div>
|
|
|
346 |
</div>
|
|
|
347 |
</td>
|
|
|
348 |
<td class="msource"><a ext:cls="Ext.Template" ext:member="#insertFirst" href="output/Ext.Template.html#insertFirst">Template</a></td>
|
|
|
349 |
</tr>
|
|
|
350 |
<tr class="method-row inherited alt expandable">
|
|
|
351 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
352 |
<td class="sig">
|
|
|
353 |
<a id="Ext.XTemplate-overwrite"></a>
|
|
|
354 |
<b>overwrite</b>( <code>Mixed el</code>, <code>Object/Array values</code>, <span class="optional" title="Optional">[<code>Boolean returnElement</code>]</span> ) : HTMLElement/Ext.Element <div class="mdesc">
|
|
|
355 |
<div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div>
|
|
|
356 |
<div class="long">
|
|
|
357 |
Applies the supplied values to the template and overwrites the content of el with the new node(s). <div class="mdetail-params">
|
|
|
358 |
<strong>Parameters:</strong>
|
|
|
359 |
<ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li> </ul>
|
|
|
360 |
<strong>Returns:</strong>
|
|
|
361 |
<ul>
|
|
|
362 |
<li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li>
|
|
|
363 |
</ul>
|
|
|
364 |
</div>
|
|
|
365 |
</div>
|
|
|
366 |
</div>
|
|
|
367 |
</td>
|
|
|
368 |
<td class="msource"><a ext:cls="Ext.Template" ext:member="#overwrite" href="output/Ext.Template.html#overwrite">Template</a></td>
|
|
|
369 |
</tr>
|
|
|
370 |
</table>
|
|
|
371 |
<a id="Ext.XTemplate-events"></a>
|
|
|
372 |
<h2>Public Events</h2>
|
|
|
373 |
<div class="no-members">This class has no public events.</div>
|
|
|
374 |
</div>
|