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.XTemplate</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.XTemplate-props"><img src="resources/s.gif" class="item-icon icon-prop">Properties</a>
35 <a class="inner-link" href="#Roo.XTemplate-methods"><img src="resources/s.gif" class="item-icon icon-method">Methods</a>
36 <a class="inner-link" href="#Roo.XTemplate-events"><img src="resources/s.gif" class="item-icon icon-event">Events</a>
37 <a class="inner-link" href="#Roo.XTemplate-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 <div class="inheritance res-block">
46 <pre class="res-block-inner"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
47 <img src="../../images/default/s.gif" height="1" width="20"/><img class="elbow" src="../../images/default/tree/elbow-end.gif"/>Roo.XTemplate
52 <!-- ============================== class title / details ============================ -->
55 <h1 class="classTitle">
60 <table cellspacing="0" class="class-summary-table">
62 <tr><td class="label">Package:</td><td class="hd-info">Roo</td></tr>
64 <tr><td class="label">Defined In:</td><td class="hd-info">
66 <a href="./src/Roo_XTemplate.js.html">Roo/XTemplate.js</a>.
69 <tr><td class="label">Class:</td><td class="hd-info">XTemplate</td></tr>
74 <tr><td class="label">Extends:</td><td class="hd-info">
75 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
83 <!-- ============================== class summary ========================== -->
84 <div class="description">
85 Provides a template that can have nested templates for loops or conditionals. The syntax is:<br/><pre><code><br/>var t = new Roo.MasterTemplate(<br/> '<select name="{name}">',<br/> '<tpl for="options"><option value="{value:trim}">{text:ellipsis(10)}</option></tpl>',<br/> '</select>'<br/>);<br/> <br/>// then append, applying the master template values<br/> </code></pre><br/><br/>Supported features:<br/><br/> Tags:<br/> {a_variable} - output encoded.<br/> {a_variable.format:("Y-m-d")} - call a method on the variable<br/> {a_variable:raw} - unencoded output<br/> {a_variable:toFixed(1,2)} - Roo.util.Format."toFixed"<br/> {a_variable:this.method_on_template(...)} - call a method on the template object.<br/> <br/> Tpl:<br/> <tpl for="a_variable or condition.."></tpl><br/> <tpl if="a_variable or condition"></tpl><br/> <tpl exec="some javascript"></tpl><br/><br/> <tpl for="."></tpl> - just iterate the property..<br/> <tpl for=".."></tpl> - iterates witht the parent (probably the template)
89 <!-- ============================== Class comment block... ========================== -->
91 <div class="comments">
92 <b>Class Comments / Notes</B> =>
93 <u onclick="parent.CommentDialog.showCommentId = 'Roo.XTemplate';">[Add Your comment/notes about this class]</u>
95 <iframe frameborder="0" id="comments-Roo" style="border: none;width:100%;"
96 src="/blog.php/GtkDjsComments/Roo.XTemplate.html"></iframe>
101 <!-- ============================== config options ========================== -->
106 <div class="hr"></div>
107 <a id="Roo.XTemplate-configs"></a>
113 <table cellspacing="0" class="member-table">
114 <caption>Config Options (Usually are also Properties)</caption>
118 <th class="sig-header" colspan="2">Options</th>
120 <th class="msource-header">Defined By</th>
127 <tr class="config-row expandable config-row-alt0">
128 <td class="micon"><a class="exi" href="#expand"> </a></td>
131 <a id="Roo.Template-cfg-html" name=".html"></a>
132 <div class="fixedFont">
133 <b class="itemname">html</b> : <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
139 <div class="short">The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</div>
143 <div class="long">The HTML fragment or an array of fragments to join("") or multiple arguments to join("")</div>
151 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
157 <tr class="config-row expandable config-row-alt1">
158 <td class="micon"><a class="exi" href="#expand"> </a></td>
161 <a id="Roo.Template-cfg-url" name=".url"></a>
162 <div class="fixedFont">
163 <b class="itemname">url</b> : <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
169 <div class="short">The Url to load the template from.</div>
173 <div class="long">The Url to load the template from. beware if you are loading from a url, the data may not be ready if you use it instantly..<br/> it should be fixed so that template is observable...</div>
181 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
197 <!-- ============================== public properties ==================== -->
201 <a id="Roo.XTemplate-props"></a>
207 <table cellspacing="0" class="member-table">
208 <caption class="Empty">Public Properties - Has None</caption>
214 <!-- ============================== methods summary / details ======================== -->
217 <a id="Roo.XTemplate-methods"></a>
218 <!-- constructor?? -->
225 <!-- then dynamics first -->
232 <table cellspacing="0" class="member-table">
233 <caption>Public Methods</caption>
235 <th class="sig-header" colspan="2">Method</th>
236 <th class="msource-header">Defined By</th>
246 <tr class="method-row config-row-alt0 notInherited">
247 <td class="micon"><a class="exi" href="#expand"> </a></td>
251 <a id="Roo-method-XTemplate" name=".XTemplate"></a>
252 <div class="fixedFont">
253 <span class="attributes">new <B>Roo.</B></span><b class="itemname">XTemplate</b>
263 <div class="short">Create a new Roo.XTemplate</div>
270 Create a new Roo.XTemplate
293 <tr class="method-row config-row-alt1 expandable">
294 <td class="micon"><a class="exi" href="#expand"> </a></td>
298 <a id="Roo.Template-method-append" name=".append"></a>
299 <div class="fixedFont">
300 <span class="attributes"></span><b class="itemname">append</b>
302 (<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>)
308 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
317 <div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div>
323 Applies the supplied values to the template and appends the new node(s) to el.
330 <dl class="detailList">
331 <dt class="heading">Parameters:</dt>
334 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
337 <dd>The context element</dd>
340 <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>
343 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
346 <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>
349 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
357 <dl class="detailList">
358 <dt class="heading">Returns:</dt>
360 <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>
376 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
382 <tr class="method-row config-row-alt0 expandable">
383 <td class="micon"><a class="exi" href="#expand"> </a></td>
387 <a id="Roo.Template-method-apply" name=".apply"></a>
388 <div class="fixedFont">
389 <span class="attributes"></span><b class="itemname">apply</b>
398 <div class="short">Alias for {<b>link</b> <b>applyTemplate</b>}</div>
404 Alias for {<b>link</b> <b>applyTemplate</b>}
427 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
433 <tr class="method-row config-row-alt1 expandable">
434 <td class="micon"><a class="exi" href="#expand"> </a></td>
438 <a id="Roo.Template-method-applyTemplate" name=".applyTemplate"></a>
439 <div class="fixedFont">
440 <span class="attributes"></span><b class="itemname">applyTemplate</b>
442 (<a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object">Object</a> <B><i>values</i></B>)
448 <a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>
457 <div class="short">Returns an HTML fragment of this template with the specified values applied.</div>
463 Returns an HTML fragment of this template with the specified values applied.
470 <dl class="detailList">
471 <dt class="heading">Parameters:</dt>
474 <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>
477 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
485 <dl class="detailList">
486 <dt class="heading">Returns:</dt>
488 <dd><span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> The HTML fragment</dd>
504 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
510 <tr class="method-row config-row-alt0 expandable">
511 <td class="micon"><a class="exi" href="#expand"> </a></td>
515 <a id="Roo.Template-method-compile" name=".compile"></a>
516 <div class="fixedFont">
517 <span class="attributes"></span><b class="itemname">compile</b>
525 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
534 <div class="short">Compiles the template into an internal function, eliminating the RegEx overhead.</div>
540 Compiles the template into an internal function, eliminating the RegEx overhead.
551 <dl class="detailList">
552 <dt class="heading">Returns:</dt>
554 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
570 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
576 <tr class="method-row config-row-alt1 expandable">
577 <td class="micon"><a class="exi" href="#expand"> </a></td>
581 <a id="Roo.Template-method-insertAfter" name=".insertAfter"></a>
582 <div class="fixedFont">
583 <span class="attributes"></span><b class="itemname">insertAfter</b>
585 (<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>)
591 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
600 <div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div>
606 Applies the supplied values to the template and inserts the new node(s) after el.
613 <dl class="detailList">
614 <dt class="heading">Parameters:</dt>
617 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
620 <dd>The context element</dd>
623 <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>
626 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
629 <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>
632 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
640 <dl class="detailList">
641 <dt class="heading">Returns:</dt>
643 <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>
659 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
665 <tr class="method-row config-row-alt0 expandable">
666 <td class="micon"><a class="exi" href="#expand"> </a></td>
670 <a id="Roo.Template-method-insertBefore" name=".insertBefore"></a>
671 <div class="fixedFont">
672 <span class="attributes"></span><b class="itemname">insertBefore</b>
674 (<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>)
680 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
689 <div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div>
695 Applies the supplied values to the template and inserts the new node(s) before el.
702 <dl class="detailList">
703 <dt class="heading">Parameters:</dt>
706 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
709 <dd>The context element</dd>
712 <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>
715 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
718 <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>
721 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
729 <dl class="detailList">
730 <dt class="heading">Returns:</dt>
732 <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>
748 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
754 <tr class="method-row config-row-alt1 expandable">
755 <td class="micon"><a class="exi" href="#expand"> </a></td>
759 <a id="Roo.Template-method-insertFirst" name=".insertFirst"></a>
760 <div class="fixedFont">
761 <span class="attributes"></span><b class="itemname">insertFirst</b>
763 (<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>)
769 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
778 <div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div>
784 Applies the supplied values to the template and inserts the new node(s) as the first child of el.
791 <dl class="detailList">
792 <dt class="heading">Parameters:</dt>
795 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
798 <dd>The context element</dd>
801 <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>
804 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
807 <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>
810 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
818 <dl class="detailList">
819 <dt class="heading">Returns:</dt>
821 <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>
837 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
843 <tr class="method-row config-row-alt0 expandable">
844 <td class="micon"><a class="exi" href="#expand"> </a></td>
848 <a id="Roo.Template-method-overwrite" name=".overwrite"></a>
849 <div class="fixedFont">
850 <span class="attributes"></span><b class="itemname">overwrite</b>
852 (<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>)
858 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037">HTMLElement</a>/Roo.Element
867 <div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div>
873 Applies the supplied values to the template and overwrites the content of el with the new node(s).
880 <dl class="detailList">
881 <dt class="heading">Parameters:</dt>
884 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a>/HTMLElement/Roo.Element</span> <b>el</b>
887 <dd>The context element</dd>
890 <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>
893 <dd>The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</dd>
896 <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>
899 <dd>(optional) true to return a Roo.Element (defaults to undefined)</dd>
907 <dl class="detailList">
908 <dt class="heading">Returns:</dt>
910 <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>
926 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
932 <tr class="method-row config-row-alt1 expandable">
933 <td class="micon"><a class="exi" href="#expand"> </a></td>
937 <a id="Roo.Template-method-set" name=".set"></a>
938 <div class="fixedFont">
939 <span class="attributes"></span><b class="itemname">set</b>
941 (<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>)
947 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
956 <div class="short">Sets the HTML used as the template and optionally compiles it.</div>
962 Sets the HTML used as the template and optionally compiles it.
969 <dl class="detailList">
970 <dt class="heading">Parameters:</dt>
973 <span class="fixedFont"><a href="./String.html#constructor" roo:cls="String.html#constructor">String</a></span> <b>html</b>
979 <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>
982 <dd>(optional) True to compile the template (defaults to undefined)</dd>
990 <dl class="detailList">
991 <dt class="heading">Returns:</dt>
993 <dd><span class="fixedFont"><a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a></span> this</dd>
1007 <td class="msource">
1009 <a href="./Roo.Template.html#constructor" roo:cls="Roo.Template.html#constructor">Roo.Template</a>
1018 <!-- ============================== events summary / details ======================== -->
1021 <a id="Roo.XTemplate-events"></a>
1027 <table cellspacing="0" class="member-table">
1028 <caption class="Empty">Events - Has None</caption>
1039 <!-- ============================== footer ================================= -->
1040 <div class="fineprint" style="clear:both">
1042 Documentation generated by <a href="http://www.akbkhome.com" target="_blankt">Introspection Doc Generator</a> on Sat Apr 07 2012 11:50:40 GMT+0800 (HKT)
1044 <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a>