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>
70 <!-- ============================== class summary ========================== -->
71 <div class="description">
72 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>.
76 <!-- ============================== Class comment block... ========================== -->
78 <div class="comments">
79 <b>Class Comments / Notes</B> =>
80 <u onclick="parent.CommentDialog.showCommentId = 'Roo.Template';">[Add Your comment/notes about this class]</u>
82 <iframe frameborder="0" id="comments-Roo" style="border: none;width:100%;"
83 src="/blog.php/GtkDjsComments/Roo.Template.html"></iframe>
88 <!-- ============================== config options ========================== -->
93 <div class="hr"></div>
94 <a id="Roo.Template-configs"></a>
98 <table cellspacing="0" class="member-table">
99 <caption class="Empty">Config Options - Has None</caption>
113 <!-- ============================== public properties ==================== -->
117 <a id="Roo.Template-props"></a>
123 <table cellspacing="0" class="member-table">
124 <caption class="Empty">Public Properties - Has None</caption>
130 <!-- ============================== methods summary / details ======================== -->
133 <a id="Roo.Template-methods"></a>
134 <!-- constructor?? -->
141 <!-- then dynamics first -->
148 <table cellspacing="0" class="member-table">
149 <caption>Public Methods</caption>
151 <th class="sig-header" colspan="2">Method</th>
152 <th class="msource-header">Defined By</th>
162 <tr class="method-row config-row-alt0 expandable notInherited">
163 <td class="micon"><a class="exi" href="#expand"> </a></td>
167 <a id="Roo-method-Template" name=".Template"></a>
168 <div class="fixedFont">
169 <span class="attributes">new <B>Roo.</B></span><b class="itemname">Template</b>
171 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/Array <B><i>html</i></B>)
179 <div class="short">Create a new Roo.Template</div>
186 Create a new Roo.Template
189 <dl class="detailList">
190 <dt class="heading">Parameters:</dt>
193 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/Array</span> <b>html</b>
196 <dd>The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</dd>
220 <tr class="method-row config-row-alt1 expandable notInherited">
221 <td class="micon"><a class="exi" href="#expand"> </a></td>
225 <a id="Roo.Template-method-from" name=".from"></a>
226 <div class="fixedFont">
227 <span class="attributes">Roo.Template.</span><b class="itemname">from</b>
229 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement <B><i>el</i></B>)
236 <div class="short">Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.</div>
242 Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
249 <dl class="detailList">
250 <dt class="heading">Parameters:</dt>
253 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement</span> <b>el</b>
256 <dd>A DOM element or its id</dd>
282 <tr class="method-row config-row-alt0 expandable notInherited">
283 <td class="micon"><a class="exi" href="#expand"> </a></td>
287 <a id="Roo.Template-method-append" name=".append"></a>
288 <div class="fixedFont">
289 <span class="attributes"></span><b class="itemname">append</b>
291 (<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>)
297 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
306 <div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div>
312 Applies the supplied values to the template and appends the new node(s) to el.
319 <dl class="detailList">
320 <dt class="heading">Parameters:</dt>
323 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
326 <dd>The context element</dd>
329 <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>
332 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
335 <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>
338 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
346 <dl class="detailList">
347 <dt class="heading">Returns:</dt>
349 <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>
371 <tr class="method-row config-row-alt1 expandable notInherited">
372 <td class="micon"><a class="exi" href="#expand"> </a></td>
376 <a id="Roo.Template-method-apply" name=".apply"></a>
377 <div class="fixedFont">
378 <span class="attributes"></span><b class="itemname">apply</b>
387 <div class="short">Alias for {<b>link</b> <b>applyTemplate</b>}</div>
393 Alias for {<b>link</b> <b>applyTemplate</b>}
422 <tr class="method-row config-row-alt0 expandable notInherited">
423 <td class="micon"><a class="exi" href="#expand"> </a></td>
427 <a id="Roo.Template-method-applyTemplate" name=".applyTemplate"></a>
428 <div class="fixedFont">
429 <span class="attributes"></span><b class="itemname">applyTemplate</b>
431 (<a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>)
437 <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
446 <div class="short">Returns an HTML fragment of this template with the specified values applied.</div>
452 Returns an HTML fragment of this template with the specified values applied.
459 <dl class="detailList">
460 <dt class="heading">Parameters:</dt>
463 <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>
466 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
474 <dl class="detailList">
475 <dt class="heading">Returns:</dt>
477 <dd><span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> The HTML fragment</dd>
499 <tr class="method-row config-row-alt1 expandable notInherited">
500 <td class="micon"><a class="exi" href="#expand"> </a></td>
504 <a id="Roo.Template-method-compile" name=".compile"></a>
505 <div class="fixedFont">
506 <span class="attributes"></span><b class="itemname">compile</b>
514 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
523 <div class="short">Compiles the template into an internal function, eliminating the RegEx overhead.</div>
529 Compiles the template into an internal function, eliminating the RegEx overhead.
540 <dl class="detailList">
541 <dt class="heading">Returns:</dt>
543 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
565 <tr class="method-row config-row-alt0 expandable notInherited">
566 <td class="micon"><a class="exi" href="#expand"> </a></td>
570 <a id="Roo.Template-method-insertAfter" name=".insertAfter"></a>
571 <div class="fixedFont">
572 <span class="attributes"></span><b class="itemname">insertAfter</b>
574 (<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>)
580 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
589 <div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div>
595 Applies the supplied values to the template and inserts the new node(s) after el.
602 <dl class="detailList">
603 <dt class="heading">Parameters:</dt>
606 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
609 <dd>The context element</dd>
612 <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>
615 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
618 <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>
621 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
629 <dl class="detailList">
630 <dt class="heading">Returns:</dt>
632 <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>
654 <tr class="method-row config-row-alt1 expandable notInherited">
655 <td class="micon"><a class="exi" href="#expand"> </a></td>
659 <a id="Roo.Template-method-insertBefore" name=".insertBefore"></a>
660 <div class="fixedFont">
661 <span class="attributes"></span><b class="itemname">insertBefore</b>
663 (<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>)
669 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
678 <div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div>
684 Applies the supplied values to the template and inserts the new node(s) before el.
691 <dl class="detailList">
692 <dt class="heading">Parameters:</dt>
695 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
698 <dd>The context element</dd>
701 <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>
704 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
707 <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>
710 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
718 <dl class="detailList">
719 <dt class="heading">Returns:</dt>
721 <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>
743 <tr class="method-row config-row-alt0 expandable notInherited">
744 <td class="micon"><a class="exi" href="#expand"> </a></td>
748 <a id="Roo.Template-method-insertFirst" name=".insertFirst"></a>
749 <div class="fixedFont">
750 <span class="attributes"></span><b class="itemname">insertFirst</b>
752 (<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>)
758 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
767 <div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div>
773 Applies the supplied values to the template and inserts the new node(s) as the first child of el.
780 <dl class="detailList">
781 <dt class="heading">Parameters:</dt>
784 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
787 <dd>The context element</dd>
790 <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>
793 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
796 <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>
799 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
807 <dl class="detailList">
808 <dt class="heading">Returns:</dt>
810 <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>
832 <tr class="method-row config-row-alt1 expandable notInherited">
833 <td class="micon"><a class="exi" href="#expand"> </a></td>
837 <a id="Roo.Template-method-overwrite" name=".overwrite"></a>
838 <div class="fixedFont">
839 <span class="attributes"></span><b class="itemname">overwrite</b>
841 (<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>)
847 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
856 <div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div>
862 Applies the supplied values to the template and overwrites the content of el with the new node(s).
869 <dl class="detailList">
870 <dt class="heading">Parameters:</dt>
873 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
876 <dd>The context element</dd>
879 <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>
882 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
885 <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>
888 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
896 <dl class="detailList">
897 <dt class="heading">Returns:</dt>
899 <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>
921 <tr class="method-row config-row-alt0 expandable notInherited">
922 <td class="micon"><a class="exi" href="#expand"> </a></td>
926 <a id="Roo.Template-method-set" name=".set"></a>
927 <div class="fixedFont">
928 <span class="attributes"></span><b class="itemname">set</b>
930 (<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>)
936 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
945 <div class="short">Sets the HTML used as the template and optionally compiles it.</div>
951 Sets the HTML used as the template and optionally compiles it.
958 <dl class="detailList">
959 <dt class="heading">Parameters:</dt>
962 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>html</b>
968 <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>
971 <dd>(optional) True to compile the template (defaults to undefined)</dd>
979 <dl class="detailList">
980 <dt class="heading">Returns:</dt>
982 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
1007 <!-- ============================== events summary / details ======================== -->
1010 <a id="Roo.Template-events"></a>
1016 <table cellspacing="0" class="member-table">
1017 <caption class="Empty">Events - Has None</caption>
1028 <!-- ============================== footer ================================= -->
1029 <div class="fineprint" style="clear:both">
1031 Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a> on Fri Jul 16 2010 16:11:50 GMT+0800 (HKT)
1033 <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>