Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / output / Ext.XTemplate.html
1 <div xmlns:ext="http://www.extjs.com" class="body-wrap"><div class="inheritance res-block"><pre class="res-block-inner"><a href="output/Ext.Template.html" ext:member="" ext:cls="Ext.Template">Template</a>&#13;&nbsp;&nbsp;<img src="resources/elbow-end.gif">XTemplate</pre></div><h1>Class <a href="source/XTemplate.html#cls-Ext.XTemplate">Ext.XTemplate</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext</td></tr><tr><td class="label">Defined In:</td><td class="hd-info">XTemplate.js</td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/XTemplate.html#cls-Ext.XTemplate">XTemplate</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info"><a href="output/Ext.Template.html" ext:cls="Ext.Template" ext:member="">Template</a></td></tr></table><div class="description"><p>A template class that supports advanced functionality like:<div class="mdetail-params"><ul>
2 <li>Autofilling arrays using templates and sub-templates</li>
3 <li>Conditional processing with basic comparison operators</li>
4 <li>Basic math function support</li>
5 <li>Execute arbitrary inline code with special built-in template variables</li>
6 <li>Custom member functions</li>
7 <li>Many special tags and built-in operators that aren't defined as part of
8 the API, but are supported in the templates that can be created</li>
9 </ul></div></p>
10 <p>XTemplate provides the templating mechanism built into:<div class="mdetail-params"><ul>
11 <li><a href="output/Ext.DataView.html" ext:cls="Ext.DataView">Ext.DataView</a></li>
12 <li><a href="output/Ext.ListView.html" ext:cls="Ext.ListView">Ext.ListView</a></li>
13 <li><a href="output/Ext.form.ComboBox.html" ext:cls="Ext.form.ComboBox">Ext.form.ComboBox</a></li>
14 <li><a href="output/Ext.grid.TemplateColumn.html" ext:cls="Ext.grid.TemplateColumn">Ext.grid.TemplateColumn</a></li>
15 <li><a href="output/Ext.grid.GroupingView.html" ext:cls="Ext.grid.GroupingView">Ext.grid.GroupingView</a></li>
16 <li><a href="output/Ext.menu.Item.html" ext:cls="Ext.menu.Item">Ext.menu.Item</a></li>
17 <li><a href="output/Ext.layout.MenuLayout.html" ext:cls="Ext.layout.MenuLayout">Ext.layout.MenuLayout</a></li>
18 <li><a href="output/Ext.ColorPalette.html" ext:cls="Ext.ColorPalette">Ext.ColorPalette</a></li>
19 </ul></div></p>
20 <p>For example usage <a href="output/Ext.XTemplate.html#Ext.XTemplate-XTemplate" ext:member="XTemplate" ext:cls="Ext.XTemplate">see the constructor</a>.</p></div><div class="hr"></div><a id="Ext.XTemplate-configs"></a><h2>Config Options</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Config Options</th><th class="msource-header">Defined By</th></tr><tr class="config-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-compiled"></a><b><a href="source/Template.html#cfg-Ext.Template-compiled">compiled</a></b> : Boolean<div class="mdesc">Specify <tt>true</tt> to compile the template
21 immediately (see <code><a href="output/Ext.Template.html#Ext.Template-compile" ext:member="compile" ext:cls="Ext.Template">compile</a></code>).
22 Defaults to <tt>false</tt>.</div></td><td class="msource"><a href="output/Ext.Template.html#compiled" ext:member="#compiled" ext:cls="Ext.Template">Template</a></td></tr><tr class="config-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-disableFormats"></a><b><a href="source/Template-more.html#cfg-Ext.Template-disableFormats">disableFormats</a></b> : Boolean<div class="mdesc"><div class="short">Specify true to disable format&#13;
23 functions in the template. If the template does not contain&#13;
24 format functions, settin...</div><div class="long">Specify <tt>true</tt> to disable format\r
25 functions in the template. If the template does not contain\r
26 <a href="output/Ext.util.Format.html" ext:cls="Ext.util.Format">format functions</a>, setting <code>disableFormats</code>\r
27 to true will reduce <code><a href="output/Ext.Template.html#Ext.Template-apply" ext:member="apply" ext:cls="Ext.Template">apply</a></code> time. Defaults to <tt>false</tt>.\r
28 <pre><code><b>var</b> t = <b>new</b> Ext.Template(\r
29     <em>'&lt;div name=<em>"{id}"</em>&gt;'</em>,\r
30         <em>'&lt;span class=<em>"{cls}"</em>&gt;{name} {value}&lt;/span&gt;'</em>,\r
31     <em>'&lt;/div&gt;'</em>,\r
32     {\r
33         compiled: true,      <i>// <a href="output/Ext.Template.html#Ext.Template-compile" ext:member="compile" ext:cls="Ext.Template">compile</a> immediately\r</i>
34         disableFormats: true <i>// reduce <code><a href="output/Ext.Template.html#Ext.Template-apply" ext:member="apply" ext:cls="Ext.Template">apply</a></i></code> time since no formatting\r
35     }    \r
36 );\r
37 </code></pre>\r
38 For a list of available format functions, see <a href="output/Ext.util.Format.html" ext:cls="Ext.util.Format">Ext.util.Format</a>.</div></div></td><td class="msource"><a href="output/Ext.Template.html#disableFormats" ext:member="#disableFormats" ext:cls="Ext.Template">Template</a></td></tr><tr class="config-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-re"></a><b><a href="source/Template.html#cfg-Ext.Template-re">re</a></b> : RegExp<div class="mdesc"><div class="short">The regular expression used to match template variables.
39 Defaults to:re : /\{([\w-]+)\}/g                            ...</div><div class="long">The regular expression used to match template variables.
40 Defaults to:<pre><code>re : /\{([\w-]+)\}/g                                     <i>// <b>for</b> Ext Core</i>
41 re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g      <i>// <b>for</b> Ext JS</i></code></pre></div></div></td><td class="msource"><a href="output/Ext.Template.html#re" ext:member="#re" ext:cls="Ext.Template">Template</a></td></tr></tbody></table><a id="Ext.XTemplate-props"></a><h2>Public Properties</h2><div class="no-members">This class has no public properties.</div><a id="Ext.XTemplate-methods"></a><h2>Public Methods</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Method</th><th class="msource-header">Defined By</th></tr><tr class="method-row expandable"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.XTemplate-XTemplate"></a><b><a href="source/XTemplate.html#cls-Ext.XTemplate">XTemplate</a></b>(&nbsp;<code>Mixed&nbsp;config</code>&nbsp;)
42     <div class="mdesc"><div class="short">The Ext.Template constructor describes
43 the acceptable parameters to pass to the constructor. The following
44 examples d...</div><div class="long">The <a href="output/Ext.Template.html#Ext.Template-Template" ext:member="Template" ext:cls="Ext.Template">Ext.Template constructor</a> describes
45 the acceptable parameters to pass to the constructor. The following
46 examples demonstrate all of the supported features.</p>
47 <div class="mdetail-params"><ul>
48 <li><b><u>Sample Data</u></b> 
49 <div class="sub-desc">
50 <p>This is the data object used for reference in each code example:</p>
51 <pre><code><b>var</b> data = {
52     name: <em>'Jack Slocum'</em>,
53     title: <em>'Lead Developer'</em>,
54     company: <em>'Ext JS, LLC'</em>,
55     email: <em>'jack@extjs.com'</em>,
56     address: <em>'4 Red Bulls Drive'</em>,
57     city: <em>'Cleveland'</em>,
58     state: <em>'Ohio'</em>,
59     zip: <em>'44102'</em>,
60     drinks: [<em>'Red Bull'</em>, <em>'Coffee'</em>, <em>'Water'</em>],
61     kids: [{
62         name: <em>'Sara Grace'</em>,
63         age:3
64     },{
65         name: <em>'Zachary'</em>,
66         age:2
67     },{
68         name: <em>'John James'</em>,
69         age:0
70     }]
71 };</code></pre>
72 </div>
73 </li>
74 <li><b><u>Auto filling of arrays</u></b> 
75 <div class="sub-desc">
76 <p>The <b><tt>tpl</tt></b> tag and the <b><tt>for</tt></b> operator are used
77 to process the provided data object:
78 <ul>
79 <li>If the value specified in <tt>for</tt> is an array, it will auto-fill,
80 repeating the template block inside the <tt>tpl</tt> tag for each item in the
81 array.</li>
82 <li>If <tt>for="."</tt> is specified, the data object provided is examined.</li>
83 <li>While processing an array, the special variable <tt>{#}</tt>
84 will provide the current array index + 1 (starts at 1, not 0).</li>
85 </ul>
86 </p>
87 <pre><code>&lt;tpl <b><b>for</b></b>=<em>"."</em>>...&lt;/tpl>       <i>// loop through array at root node</i>
88 &lt;tpl <b><b>for</b></b>=<em>"foo"</em>>...&lt;/tpl>     <i>// loop through array at foo node</i>
89 &lt;tpl <b><b>for</b></b>=<em>"foo.bar"</em>>...&lt;/tpl> <i>// loop through array at foo.bar node</i></code></pre>
90 Using the sample data above:
91 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
92     <em>'&lt;p>Kids: '</em>,
93     <em>'&lt;tpl <b><b>for</b></b>=<em>"."</em>>'</em>,       <i>// process the data.kids node</i>
94         <em>'&lt;p>{#}. {name}&lt;/p>'</em>,  <i>// use current array index to autonumber</i>
95     <em>'&lt;/tpl>&lt;/p>'</em>
96 );
97 tpl.overwrite(panel.body, data.kids); <i>// pass the kids property of the data object</i></code></pre>
98 <p>An example illustrating how the <b><tt>for</tt></b> property can be leveraged
99 to access specified members of the provided data object to populate the template:</p>
100 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
101     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
102     <em>'&lt;p>Title: {title}&lt;/p>'</em>,
103     <em>'&lt;p>Company: {company}&lt;/p>'</em>,
104     <em>'&lt;p>Kids: '</em>,
105     <em>'&lt;tpl <b><b>for</b>=<em>"kids"</em></b>>'</em>,     <i>// interrogate the kids property within the data</i>
106         <em>'&lt;p>{name}&lt;/p>'</em>,
107     <em>'&lt;/tpl>&lt;/p>'</em>
108 );
109 tpl.overwrite(panel.body, data);  <i>// pass the root node of the data object</i></code></pre>
110 <p>Flat arrays that contain values (and not objects) can be auto-rendered
111 using the special <b><tt>{.}</tt></b> variable inside a loop.  This variable
112 will represent the value of the array at the current index:</p>
113 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
114     <em>'&lt;p>{name}\&#39;s favorite beverages:&lt;/p>'</em>,
115     <em>'&lt;tpl <b>for</b>=<em>"drinks"</em>>'</em>,
116        <em>'&lt;div> - {.}&lt;/div>'</em>,
117     <em>'&lt;/tpl>'</em>
118 );
119 tpl.overwrite(panel.body, data);</code></pre>
120 <p>When processing a sub-template, for example while looping through a child array,
121 you can access the parent object's members via the <b><tt>parent</tt></b> object:</p>
122 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
123     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
124     <em>'&lt;p>Kids: '</em>,
125     <em>'&lt;tpl <b>for</b>=<em>"kids"</em>>'</em>,
126         <em>'&lt;tpl <b>if</b>=<em>"age > 1"</em>>'</em>,
127             <em>'&lt;p>{name}&lt;/p>'</em>,
128             <em>'&lt;p>Dad: {<b>parent</b>.name}&lt;/p>'</em>,
129         <em>'&lt;/tpl>'</em>,
130     <em>'&lt;/tpl>&lt;/p>'</em>
131 );
132 tpl.overwrite(panel.body, data);</code></pre>
133 </div>
134 </li>
135 <li><b><u>Conditional processing with basic comparison operators</u></b> 
136 <div class="sub-desc">
137 <p>The <b><tt>tpl</tt></b> tag and the <b><tt>if</tt></b> operator are used
138 to provide conditional checks for deciding whether or not to render specific
139 parts of the template. Notes:<div class="sub-desc"><ul>
140 <li>Double quotes must be encoded if used within the conditional</li>
141 <li>There is no <tt>else</tt> operator &mdash; if needed, two opposite
142 <tt>if</tt> statements should be used.</li>
143 </ul></div>
144 <pre><code>&lt;tpl <b>if</b>=<em>"age &gt; 1 &amp;&amp; age &lt; 10"</em>>Child&lt;/tpl>
145 &lt;tpl <b>if</b>=<em>"age >= 10 && age < 18"</em>>Teenager&lt;/tpl>
146 &lt;tpl <b><b>if</b></b>=<em>"this.isGirl(name)"</em>>...&lt;/tpl>
147 &lt;tpl <b><b>if</b></b>=<em>"id==\<em>'download\'</em>"</em>>...&lt;/tpl>
148 &lt;tpl <b><b>if</b></b>=<em>"needsIcon"</em>>&lt;img src=<em>"{icon}"</em> class=<em>"{iconCls}"</em>/>&lt;/tpl>
149 <i>// no good:</i>
150 &lt;tpl <b>if</b>=<em>"name == "</em>Jack<em>""</em>>Hello&lt;/tpl>
151 <i>// encode &#34; <b>if</b> it is part of the condition, e.g.</i>
152 &lt;tpl <b>if</b>=<em>"name == &#38;quot;Jack&#38;quot;"</em>>Hello&lt;/tpl></code></pre>
153 Using the sample data above:
154 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
155     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
156     <em>'&lt;p>Kids: '</em>,
157     <em>'&lt;tpl <b>for</b>=<em>"kids"</em>>'</em>,
158         <em>'&lt;tpl <b>if</b>=<em>"age > 1"</em>>'</em>,
159             <em>'&lt;p>{name}&lt;/p>'</em>,
160         <em>'&lt;/tpl>'</em>,
161     <em>'&lt;/tpl>&lt;/p>'</em>
162 );
163 tpl.overwrite(panel.body, data);</code></pre>
164 </div>
165 </li>
166 <li><b><u>Basic math support</u></b> 
167 <div class="sub-desc">
168 <p>The following basic math operators may be applied directly on numeric
169 data values:</p><pre>
170 + - * /
171 </pre>
172 For example:
173 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
174     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
175     <em>'&lt;p>Kids: '</em>,
176     <em>'&lt;tpl <b>for</b>=<em>"kids"</em>>'</em>,
177         <em>'&lt;tpl <b>if</b>=<em>"age &amp;gt; 1"</em>>'</em>,  <i>// <-- Note that the &gt; is encoded</i>
178             <em>'&lt;p>{#}: {name}&lt;/p>'</em>,  <i>// <-- Auto-number each item</i>
179             <em>'&lt;p>In 5 Years: {age+5}&lt;/p>'</em>,  <i>// <-- Basic math</i>
180             <em>'&lt;p>Dad: {parent.name}&lt;/p>'</em>,
181         <em>'&lt;/tpl>'</em>,
182     <em>'&lt;/tpl>&lt;/p>'</em>
183 );
184 tpl.overwrite(panel.body, data);</code></pre>
185 </div>
186 </li>
187 <li><b><u>Execute arbitrary inline code with special built-in template variables</u></b> 
188 <div class="sub-desc">
189 <p>Anything between <code>{[ ... ]}</code> is considered code to be executed
190 in the scope of the template. There are some special variables available in that code:
191 <ul>
192 <li><b><tt>values</tt></b>: The values in the current scope. If you are using
193 scope changing sub-templates, you can change what <tt>values</tt> is.</li>
194 <li><b><tt>parent</tt></b>: The scope (values) of the ancestor template.</li>
195 <li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the
196 loop you are in (1-based).</li>
197 <li><b><tt>xcount</tt></b>: If you are in a looping template, the total length
198 of the array you are looping.</li>
199 <li><b><tt>fm</tt></b>: An alias for <tt>Ext.util.Format</tt>.</li>
200 </ul>
201 This example demonstrates basic row striping using an inline code block and the
202 <tt>xindex</tt> variable:</p>
203 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
204     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
205     <em>'&lt;p>Company: {[values.company.toUpperCase() + <em>", "</em> + values.title]}&lt;/p>'</em>,
206     <em>'&lt;p>Kids: '</em>,
207     <em>'&lt;tpl <b>for</b>=<em>"kids"</em>>'</em>,
208        <em>'&lt;div class=<em>"{[xindex % 2 === 0 ? "</em>even<em>" : "</em>odd<em>"]}"</em>>'</em>,
209         <em>'{name}'</em>,
210         <em>'&lt;/div>'</em>,
211     <em>'&lt;/tpl>&lt;/p>'</em>
212 );
213 tpl.overwrite(panel.body, data);</code></pre>
214 </div>
215 </li>
216 <li><b><u>Template member functions</u></b> 
217 <div class="sub-desc">
218 <p>One or more member functions can be specified in a configuration
219 object passed into the XTemplate constructor for more complex processing:</p>
220 <pre><code><b>var</b> tpl = <b>new</b> Ext.XTemplate(
221     <em>'&lt;p>Name: {name}&lt;/p>'</em>,
222     <em>'&lt;p>Kids: '</em>,
223     <em>'&lt;tpl <b>for</b>=<em>"kids"</em>>'</em>,
224         <em>'&lt;tpl <b>if</b>=<em>"this.isGirl(name)"</em>>'</em>,
225             <em>'&lt;p>Girl: {name} - {age}&lt;/p>'</em>,
226         <em>'&lt;/tpl>'</em>,
227         <i>// use opposite <b>if</b> statement to simulate <em>'<b>else</b>'</em> processing:</i>
228         <em>'&lt;tpl <b>if</b>=<em>"this.isGirl(name) == false"</em>>'</em>,
229             <em>'&lt;p>Boy: {name} - {age}&lt;/p>'</em>,
230         <em>'&lt;/tpl>'</em>,
231         <em>'&lt;tpl <b>if</b>=<em>"this.isBaby(age)"</em>>'</em>,
232             <em>'&lt;p>{name} is a baby!&lt;/p>'</em>,
233         <em>'&lt;/tpl>'</em>,
234     <em>'&lt;/tpl>&lt;/p>'</em>,
235     {
236         <i>// XTemplate configuration:</i>
237         compiled: true,
238         disableFormats: true,
239         <i>// member functions:</i>
240         isGirl: <b>function</b>(name){
241             <b>return</b> name == <em>'Sara Grace'</em>;
242         },
243         isBaby: <b>function</b>(age){
244             <b>return</b> age < 1;
245         }
246     }
247 );
248 tpl.overwrite(panel.body, data);</code></pre>
249 </div>
250 </li>
251 </ul></div><div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>config</code> : Mixed<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">XTemplate</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.XTemplate-XTemplate.from"></a><b><a href="source/XTemplate.html#method-Ext.XTemplate-XTemplate.from">XTemplate.from</a></b>(&nbsp;<code>String/HTMLElement&nbsp;el</code>&nbsp;)
252     :
253                                         Ext.Template<div class="mdesc"><div class="short">&lt;static&gt;&nbsp;Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML.</div><div class="long">&lt;static&gt;&nbsp;Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">A DOM element or its id</div></li></ul><strong>Returns:</strong><ul><li><code>Ext.Template</code><div class="sub-desc">The created template</div></li></ul></div></div></div></td><td class="msource">XTemplate</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-append"></a><b><a href="source/Template.html#method-Ext.Template-append">append</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
254     :
255                                         HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and appends
256 the new node(s) to the specified el.
257 For example usage see th...</div><div class="long">Applies the supplied <code>values</code> to the template and appends
258 the new node(s) to the specified <code>el</code>.
259 <p>For example usage <a href="output/Ext.Template.html#Ext.Template-Template" ext:member="Template" ext:cls="Ext.Template">see the constructor</a>.</p><div class="mdetail-params"><strong>Parameters:</strong><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 the params are numeric (i.e. <code>{0}</code>)
260 or an object (i.e. <code>{foo: <em>'bar'</em>}</code>).</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return an Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#append" ext:member="#append" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.XTemplate-apply"></a><b><a href="source/XTemplate.html#method-Ext.XTemplate-apply">apply</a></b>(&nbsp;<code>Object/Array&nbsp;values</code>&nbsp;)
261     :
262                                         String<div class="mdesc"><div class="short">Alias for applyTemplate
263 Returns an HTML fragment of this template with the specified values applied.</div><div class="long">Alias for <a href="output/Ext.XTemplate.html#Ext.XTemplate-applyTemplate" ext:member="applyTemplate" ext:cls="Ext.XTemplate">applyTemplate</a>
264 Returns an HTML fragment of this template with the specified values applied.<div class="mdetail-params"><strong>Parameters:</strong><ul><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></ul><strong>Returns:</strong><ul><li><code>String</code><div class="sub-desc">The HTML fragment</div></li></ul></div></div></div></td><td class="msource">XTemplate</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.XTemplate-applyTemplate"></a><b><a href="source/XTemplate.html#method-Ext.XTemplate-applyTemplate">applyTemplate</a></b>(&nbsp;<code>Object&nbsp;values</code>&nbsp;)
265     :
266                                         String<div class="mdesc"><div class="short">Returns an HTML fragment of this template with the specified values applied.</div><div class="long">Returns an HTML fragment of this template with the specified values applied.<div class="mdetail-params"><strong>Parameters:</strong><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><strong>Returns:</strong><ul><li><code>String</code><div class="sub-desc">The HTML fragment</div></li></ul></div></div></div></td><td class="msource">XTemplate</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.XTemplate-compile"></a><b><a href="source/XTemplate.html#method-Ext.XTemplate-compile">compile</a></b>()
267     :
268                                         Function<div class="mdesc"><div class="short">Compile the template to a function for optimized performance.  Recommended if the template will be used frequently.</div><div class="long">Compile the template to a function for optimized performance.  Recommended if the template will be used frequently.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>Function</code><div class="sub-desc">The compiled function</div></li></ul></div></div></div></td><td class="msource">XTemplate</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertAfter"></a><b><a href="source/Template.html#method-Ext.Template-insertAfter">insertAfter</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
269     :
270                                         HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) after el.<div class="mdetail-params"><strong>Parameters:</strong><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><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertAfter" ext:member="#insertAfter" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertBefore"></a><b><a href="source/Template.html#method-Ext.Template-insertBefore">insertBefore</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
271     :
272                                         HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) before el.<div class="mdetail-params"><strong>Parameters:</strong><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><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertBefore" ext:member="#insertBefore" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertFirst"></a><b><a href="source/Template.html#method-Ext.Template-insertFirst">insertFirst</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
273     :
274                                         HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) as the first child of el.<div class="mdetail-params"><strong>Parameters:</strong><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><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertFirst" ext:member="#insertFirst" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-overwrite"></a><b><a href="source/Template.html#method-Ext.Template-overwrite">overwrite</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
275     :
276                                         HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div><div class="long">Applies the supplied values to the template and overwrites the content of el with the new node(s).<div class="mdetail-params"><strong>Parameters:</strong><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><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#overwrite" ext:member="#overwrite" ext:cls="Ext.Template">Template</a></td></tr></tbody></table><a id="Ext.XTemplate-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>