1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <meta http-equiv="content-type" content="text/html; charset=undefined" />
8 <meta name="generator" content="JsDoc Toolkit" />
11 <title>JsDoc Reference - Roo.Template</title>
14 <link rel="stylesheet" type="text/css" href="../../css/roojs.css" />
15 <link rel="stylesheet" type="text/css" href="../default.css" />
18 <script type="text/javascript" src="../page.js">
25 <body onload="RooDocsPage.onload();">
28 <div class="body-wrap">
30 <!-- ============================== links to methods. ================================= -->
32 <div class="top-tools">
34 <a class="inner-link" href="#Roo.Template-props"><img src="resources/s.gif" class="item-icon icon-prop">Properties</a>
35 <a class="inner-link" href="#Roo.Template-methods"><img src="resources/s.gif" class="item-icon icon-method">Methods</a>
36 <a class="inner-link" href="#Roo.Template-events"><img src="resources/s.gif" class="item-icon icon-event">Events</a>
37 <a class="inner-link" href="#Roo.Template-configs"><img src="resources/s.gif" class="item-icon icon-config">Config Options</a>
38 <a class="bookmark" href="NEED_TO_CREATE_DIRECT_LINK_HREF"><img src="resources/s.gif" class="item-icon icon-fav">Direct Link</a>
43 <!-- ============================== inheritance Block. ================================= -->
45 <!-- ============================== class title / details ============================ -->
48 <h1 class="classTitle">
53 <table cellspacing="0" class="class-summary-table">
55 <tr><td class="label">Package:</td><td class="hd-info">Roo</td></tr>
57 <tr><td class="label">Defined In:</td><td class="hd-info">
59 <a href="./src/Roo_Template.js.html">Roo/Template.js</a>.
62 <tr><td class="label">Class:</td><td class="hd-info">Template</td></tr>
65 <tr><td class="label">Subclasses:</td><td class="hd-info">
66 <a href="./Roo.MasterTemplate.html#constructor" roo:cls="Roo.MasterTemplate.html#constructor">Roo.MasterTemplate</a>
77 <!-- ============================== class summary ========================== -->
78 <div class="description">
79 Represents an HTML fragment template. Templates can be precompiled for greater performance.<br/>For a list of available format functions, see {<b>link</b> Roo.util.Format}.<br /><br/>Usage:<br/><pre><code><br/>var t = new Roo.Template(<br/> '<div name="{id}">',<br/> '<span class="{cls}">{name:trim} {value:ellipsis(10)}</span>',<br/> '</div>'<br/>);<br/>t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});<br/></code></pre><br/>For more information see this blog post with examples: <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">DomHelper - Create Elements using DOM, HTML fragments and Templates</a>.
83 <!-- ============================== Class comment block... ========================== -->
85 <div class="comments">
86 <b>Class Comments / Notes</B> =>
87 <u onclick="parent.CommentDialog.showCommentId = 'Roo.Template';">[Add Your comment/notes about this class]</u>
89 <iframe frameborder="0" id="comments-Roo" style="border: none;width:100%;"
90 src="/blog.php/GtkDjsComments/Roo.Template.html"></iframe>
95 <!-- ============================== config options ========================== -->
100 <div class="hr"></div>
101 <a id="Roo.Template-configs"></a>
105 <table cellspacing="0" class="member-table">
106 <caption class="Empty">Config Options - Has None</caption>
120 <!-- ============================== public properties ==================== -->
124 <a id="Roo.Template-props"></a>
130 <table cellspacing="0" class="member-table">
131 <caption class="Empty">Public Properties - Has None</caption>
137 <!-- ============================== methods summary / details ======================== -->
140 <a id="Roo.Template-methods"></a>
141 <!-- constructor?? -->
148 <!-- then dynamics first -->
155 <table cellspacing="0" class="member-table">
156 <caption>Public Methods</caption>
158 <th class="sig-header" colspan="2">Method</th>
159 <th class="msource-header">Defined By</th>
169 <tr class="method-row config-row-alt0 expandable notInherited">
170 <td class="micon"><a class="exi" href="#expand"> </a></td>
174 <a id="Roo-method-Template" name=".Template"></a>
175 <div class="fixedFont">
176 <span class="attributes">new <B>Roo.</B></span><b class="itemname">Template</b>
178 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/Array <B><i>html</i></B>)
186 <div class="short">Create a new Roo.Template</div>
193 Create a new Roo.Template
196 <dl class="detailList">
197 <dt class="heading">Parameters:</dt>
200 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/Array</span> <b>html</b>
203 <dd>The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</dd>
227 <tr class="method-row config-row-alt1 expandable notInherited">
228 <td class="micon"><a class="exi" href="#expand"> </a></td>
232 <a id="Roo.Template-method-from" name=".from"></a>
233 <div class="fixedFont">
234 <span class="attributes">Roo.Template.</span><b class="itemname">from</b>
236 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement <B><i>el</i></B>)
243 <div class="short">Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.</div>
249 Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
256 <dl class="detailList">
257 <dt class="heading">Parameters:</dt>
260 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement</span> <b>el</b>
263 <dd>A DOM element or its id</dd>
289 <tr class="method-row config-row-alt0 expandable notInherited">
290 <td class="micon"><a class="exi" href="#expand"> </a></td>
294 <a id="Roo.Template-method-append" name=".append"></a>
295 <div class="fixedFont">
296 <span class="attributes"></span><b class="itemname">append</b>
298 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element <B><i>el</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>returnElement</i></B>)
304 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
313 <div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div>
319 Applies the supplied values to the template and appends the new node(s) to el.
326 <dl class="detailList">
327 <dt class="heading">Parameters:</dt>
330 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
333 <dd>The context element</dd>
336 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
339 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
342 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>returnElement</b>
345 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
353 <dl class="detailList">
354 <dt class="heading">Returns:</dt>
356 <dd><span class="fixedFont"><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element</span> The new node or Element</dd>
378 <tr class="method-row config-row-alt1 expandable notInherited">
379 <td class="micon"><a class="exi" href="#expand"> </a></td>
383 <a id="Roo.Template-method-apply" name=".apply"></a>
384 <div class="fixedFont">
385 <span class="attributes"></span><b class="itemname">apply</b>
394 <div class="short">Alias for {<b>link</b> <b>applyTemplate</b>}</div>
400 Alias for {<b>link</b> <b>applyTemplate</b>}
429 <tr class="method-row config-row-alt0 expandable notInherited">
430 <td class="micon"><a class="exi" href="#expand"> </a></td>
434 <a id="Roo.Template-method-applyTemplate" name=".applyTemplate"></a>
435 <div class="fixedFont">
436 <span class="attributes"></span><b class="itemname">applyTemplate</b>
438 (<a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>)
444 <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
453 <div class="short">Returns an HTML fragment of this template with the specified values applied.</div>
459 Returns an HTML fragment of this template with the specified values applied.
466 <dl class="detailList">
467 <dt class="heading">Parameters:</dt>
470 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
473 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
481 <dl class="detailList">
482 <dt class="heading">Returns:</dt>
484 <dd><span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> The HTML fragment</dd>
506 <tr class="method-row config-row-alt1 expandable notInherited">
507 <td class="micon"><a class="exi" href="#expand"> </a></td>
511 <a id="Roo.Template-method-compile" name=".compile"></a>
512 <div class="fixedFont">
513 <span class="attributes"></span><b class="itemname">compile</b>
521 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
530 <div class="short">Compiles the template into an internal function, eliminating the RegEx overhead.</div>
536 Compiles the template into an internal function, eliminating the RegEx overhead.
547 <dl class="detailList">
548 <dt class="heading">Returns:</dt>
550 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
572 <tr class="method-row config-row-alt0 expandable notInherited">
573 <td class="micon"><a class="exi" href="#expand"> </a></td>
577 <a id="Roo.Template-method-insertAfter" name=".insertAfter"></a>
578 <div class="fixedFont">
579 <span class="attributes"></span><b class="itemname">insertAfter</b>
581 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element <B><i>el</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>returnElement</i></B>)
587 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
596 <div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div>
602 Applies the supplied values to the template and inserts the new node(s) after el.
609 <dl class="detailList">
610 <dt class="heading">Parameters:</dt>
613 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
616 <dd>The context element</dd>
619 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
622 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
625 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>returnElement</b>
628 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
636 <dl class="detailList">
637 <dt class="heading">Returns:</dt>
639 <dd><span class="fixedFont"><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element</span> The new node or Element</dd>
661 <tr class="method-row config-row-alt1 expandable notInherited">
662 <td class="micon"><a class="exi" href="#expand"> </a></td>
666 <a id="Roo.Template-method-insertBefore" name=".insertBefore"></a>
667 <div class="fixedFont">
668 <span class="attributes"></span><b class="itemname">insertBefore</b>
670 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element <B><i>el</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>returnElement</i></B>)
676 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
685 <div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div>
691 Applies the supplied values to the template and inserts the new node(s) before el.
698 <dl class="detailList">
699 <dt class="heading">Parameters:</dt>
702 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
705 <dd>The context element</dd>
708 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
711 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
714 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>returnElement</b>
717 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
725 <dl class="detailList">
726 <dt class="heading">Returns:</dt>
728 <dd><span class="fixedFont"><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element</span> The new node or Element</dd>
750 <tr class="method-row config-row-alt0 expandable notInherited">
751 <td class="micon"><a class="exi" href="#expand"> </a></td>
755 <a id="Roo.Template-method-insertFirst" name=".insertFirst"></a>
756 <div class="fixedFont">
757 <span class="attributes"></span><b class="itemname">insertFirst</b>
759 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element <B><i>el</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>returnElement</i></B>)
765 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
774 <div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div>
780 Applies the supplied values to the template and inserts the new node(s) as the first child of el.
787 <dl class="detailList">
788 <dt class="heading">Parameters:</dt>
791 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
794 <dd>The context element</dd>
797 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
800 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
803 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>returnElement</b>
806 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
814 <dl class="detailList">
815 <dt class="heading">Returns:</dt>
817 <dd><span class="fixedFont"><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element</span> The new node or Element</dd>
839 <tr class="method-row config-row-alt1 expandable notInherited">
840 <td class="micon"><a class="exi" href="#expand"> </a></td>
844 <a id="Roo.Template-method-overwrite" name=".overwrite"></a>
845 <div class="fixedFont">
846 <span class="attributes"></span><b class="itemname">overwrite</b>
848 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element <B><i>el</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>returnElement</i></B>)
854 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
863 <div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div>
869 Applies the supplied values to the template and overwrites the content of el with the new node(s).
876 <dl class="detailList">
877 <dt class="heading">Parameters:</dt>
880 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
883 <dd>The context element</dd>
886 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>values</b>
889 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
892 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>returnElement</b>
895 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
903 <dl class="detailList">
904 <dt class="heading">Returns:</dt>
906 <dd><span class="fixedFont"><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element</span> The new node or Element</dd>
928 <tr class="method-row config-row-alt0 expandable notInherited">
929 <td class="micon"><a class="exi" href="#expand"> </a></td>
933 <a id="Roo.Template-method-set" name=".set"></a>
934 <div class="fixedFont">
935 <span class="attributes"></span><b class="itemname">set</b>
937 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a> <B><i>html</i></B>, <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a> <B><i>compile</i></B>)
943 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
952 <div class="short">Sets the HTML used as the template and optionally compiles it.</div>
958 Sets the HTML used as the template and optionally compiles it.
965 <dl class="detailList">
966 <dt class="heading">Parameters:</dt>
969 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>html</b>
975 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Boolean">Boolean</a></span> <b>compile</b>
978 <dd>(optional) True to compile the template (defaults to undefined)</dd>
986 <dl class="detailList">
987 <dt class="heading">Returns:</dt>
989 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
1003 <td class="msource">
1014 <!-- ============================== events summary / details ======================== -->
1017 <a id="Roo.Template-events"></a>
1023 <table cellspacing="0" class="member-table">
1024 <caption class="Empty">Events - Has None</caption>
1035 <!-- ============================== footer ================================= -->
1036 <div class="fineprint" style="clear:both">
1038 Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a> on Tue Jul 27 2010 11:05:07 GMT+0800 (HKT)
1040 <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>