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/> html : '<div name="{id}">' + <br/> '<span class="{cls}">{name:trim} {someval:this.myformat}{value:ellipsis(10)}</span>' +<br/> '</div>',<br/> myformat: function (value, allValues) {<br/> return 'XX' + value;<br/> }<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>
107 <table cellspacing="0" class="member-table">
108 <caption>Config Options (Usually are also Properties)</caption>
112 <th class="sig-header" colspan="2">Options</th>
114 <th class="msource-header">Defined By</th>
121 <tr class="config-row expandable config-row-alt0 notInherited">
122 <td class="micon"><a class="exi" href="#expand"> </a></td>
125 <a id="Roo.Template-cfg-html" name=".html"></a>
126 <div class="fixedFont">
127 <b class="itemname">html</b> : <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
133 <div class="short">The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</div>
137 <div class="long">The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</div>
161 <!-- ============================== public properties ==================== -->
165 <a id="Roo.Template-props"></a>
171 <table cellspacing="0" class="member-table">
172 <caption class="Empty">Public Properties - Has None</caption>
178 <!-- ============================== methods summary / details ======================== -->
181 <a id="Roo.Template-methods"></a>
182 <!-- constructor?? -->
189 <!-- then dynamics first -->
196 <table cellspacing="0" class="member-table">
197 <caption>Public Methods</caption>
199 <th class="sig-header" colspan="2">Method</th>
200 <th class="msource-header">Defined By</th>
210 <tr class="method-row config-row-alt0 expandable notInherited">
211 <td class="micon"><a class="exi" href="#expand"> </a></td>
215 <a id="Roo-method-Template" name=".Template"></a>
216 <div class="fixedFont">
217 <span class="attributes">new <B>Roo.</B></span><b class="itemname">Template</b>
219 (<a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>cfg</i></B>)
227 <div class="short">Create a new Roo.Template</div>
234 Create a new Roo.Template
237 <dl class="detailList">
238 <dt class="heading">Parameters:</dt>
241 <span class="fixedFont"><a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a></span> <b>cfg</b>
244 <dd>- Configuration object.</dd>
268 <tr class="method-row config-row-alt1 expandable notInherited">
269 <td class="micon"><a class="exi" href="#expand"> </a></td>
273 <a id="Roo.Template-method-from" name=".from"></a>
274 <div class="fixedFont">
275 <span class="attributes">Roo.Template.</span><b class="itemname">from</b>
277 (<a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement <B><i>el</i></B>)
284 <div class="short">Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.</div>
290 Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
297 <dl class="detailList">
298 <dt class="heading">Parameters:</dt>
301 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement</span> <b>el</b>
304 <dd>A DOM element or its id</dd>
330 <tr class="method-row config-row-alt0 expandable notInherited">
331 <td class="micon"><a class="exi" href="#expand"> </a></td>
335 <a id="Roo.Template-method-append" name=".append"></a>
336 <div class="fixedFont">
337 <span class="attributes"></span><b class="itemname">append</b>
339 (<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>)
345 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
354 <div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div>
360 Applies the supplied values to the template and appends the new node(s) to el.
367 <dl class="detailList">
368 <dt class="heading">Parameters:</dt>
371 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
374 <dd>The context element</dd>
377 <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>
380 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
383 <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>
386 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
394 <dl class="detailList">
395 <dt class="heading">Returns:</dt>
397 <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>
419 <tr class="method-row config-row-alt1 expandable notInherited">
420 <td class="micon"><a class="exi" href="#expand"> </a></td>
424 <a id="Roo.Template-method-apply" name=".apply"></a>
425 <div class="fixedFont">
426 <span class="attributes"></span><b class="itemname">apply</b>
435 <div class="short">Alias for {<b>link</b> <b>applyTemplate</b>}</div>
441 Alias for {<b>link</b> <b>applyTemplate</b>}
470 <tr class="method-row config-row-alt0 expandable notInherited">
471 <td class="micon"><a class="exi" href="#expand"> </a></td>
475 <a id="Roo.Template-method-applyTemplate" name=".applyTemplate"></a>
476 <div class="fixedFont">
477 <span class="attributes"></span><b class="itemname">applyTemplate</b>
479 (<a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>)
485 <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
494 <div class="short">Returns an HTML fragment of this template with the specified values applied.</div>
500 Returns an HTML fragment of this template with the specified values applied.
507 <dl class="detailList">
508 <dt class="heading">Parameters:</dt>
511 <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>
514 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
522 <dl class="detailList">
523 <dt class="heading">Returns:</dt>
525 <dd><span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> The HTML fragment</dd>
547 <tr class="method-row config-row-alt1 expandable notInherited">
548 <td class="micon"><a class="exi" href="#expand"> </a></td>
552 <a id="Roo.Template-method-compile" name=".compile"></a>
553 <div class="fixedFont">
554 <span class="attributes"></span><b class="itemname">compile</b>
562 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
571 <div class="short">Compiles the template into an internal function, eliminating the RegEx overhead.</div>
577 Compiles the template into an internal function, eliminating the RegEx overhead.
588 <dl class="detailList">
589 <dt class="heading">Returns:</dt>
591 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
613 <tr class="method-row config-row-alt0 expandable notInherited">
614 <td class="micon"><a class="exi" href="#expand"> </a></td>
618 <a id="Roo.Template-method-insertAfter" name=".insertAfter"></a>
619 <div class="fixedFont">
620 <span class="attributes"></span><b class="itemname">insertAfter</b>
622 (<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>)
628 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
637 <div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div>
643 Applies the supplied values to the template and inserts the new node(s) after el.
650 <dl class="detailList">
651 <dt class="heading">Parameters:</dt>
654 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
657 <dd>The context element</dd>
660 <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>
663 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
666 <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>
669 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
677 <dl class="detailList">
678 <dt class="heading">Returns:</dt>
680 <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>
702 <tr class="method-row config-row-alt1 expandable notInherited">
703 <td class="micon"><a class="exi" href="#expand"> </a></td>
707 <a id="Roo.Template-method-insertBefore" name=".insertBefore"></a>
708 <div class="fixedFont">
709 <span class="attributes"></span><b class="itemname">insertBefore</b>
711 (<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>)
717 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
726 <div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div>
732 Applies the supplied values to the template and inserts the new node(s) before el.
739 <dl class="detailList">
740 <dt class="heading">Parameters:</dt>
743 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
746 <dd>The context element</dd>
749 <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>
752 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
755 <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>
758 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
766 <dl class="detailList">
767 <dt class="heading">Returns:</dt>
769 <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>
791 <tr class="method-row config-row-alt0 expandable notInherited">
792 <td class="micon"><a class="exi" href="#expand"> </a></td>
796 <a id="Roo.Template-method-insertFirst" name=".insertFirst"></a>
797 <div class="fixedFont">
798 <span class="attributes"></span><b class="itemname">insertFirst</b>
800 (<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>)
806 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
815 <div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div>
821 Applies the supplied values to the template and inserts the new node(s) as the first child of el.
828 <dl class="detailList">
829 <dt class="heading">Parameters:</dt>
832 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
835 <dd>The context element</dd>
838 <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>
841 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
844 <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>
847 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
855 <dl class="detailList">
856 <dt class="heading">Returns:</dt>
858 <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>
880 <tr class="method-row config-row-alt1 expandable notInherited">
881 <td class="micon"><a class="exi" href="#expand"> </a></td>
885 <a id="Roo.Template-method-overwrite" name=".overwrite"></a>
886 <div class="fixedFont">
887 <span class="attributes"></span><b class="itemname">overwrite</b>
889 (<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>)
895 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
904 <div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div>
910 Applies the supplied values to the template and overwrites the content of el with the new node(s).
917 <dl class="detailList">
918 <dt class="heading">Parameters:</dt>
921 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
924 <dd>The context element</dd>
927 <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>
930 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
933 <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>
936 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
944 <dl class="detailList">
945 <dt class="heading">Returns:</dt>
947 <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>
969 <tr class="method-row config-row-alt0 expandable notInherited">
970 <td class="micon"><a class="exi" href="#expand"> </a></td>
974 <a id="Roo.Template-method-set" name=".set"></a>
975 <div class="fixedFont">
976 <span class="attributes"></span><b class="itemname">set</b>
978 (<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>)
984 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
993 <div class="short">Sets the HTML used as the template and optionally compiles it.</div>
999 Sets the HTML used as the template and optionally compiles it.
1006 <dl class="detailList">
1007 <dt class="heading">Parameters:</dt>
1010 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>html</b>
1016 <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>
1019 <dd>(optional) True to compile the template (defaults to undefined)</dd>
1027 <dl class="detailList">
1028 <dt class="heading">Returns:</dt>
1030 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
1044 <td class="msource">
1055 <!-- ============================== events summary / details ======================== -->
1058 <a id="Roo.Template-events"></a>
1064 <table cellspacing="0" class="member-table">
1065 <caption class="Empty">Events - Has None</caption>
1076 <!-- ============================== footer ================================= -->
1077 <div class="fineprint" style="clear:both">
1079 Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a> on Fri Jan 14 2011 17:01:49 GMT+0800 (HKT)
1081 <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>