51afaaf932da3946bdda8f5465b492877deef4b2
[roojs1] / docs / symbols / Roo.XTemplate.json
1 {
2   "name" : "Roo.XTemplate",
3   "augments" : [
4     "Roo.Template"
5   ],
6   "desc" : "Provides a template that can have nested templates for loops or conditionals. The syntax is:\n<pre><code>\nvar t = new Roo.XTemplate(\n\t'&lt;select name=\"{name}\"&gt;',\n\t\t'&lt;tpl for=\"options\"&gt;&lt;option value=\"{value:trim}\"&gt;{text:ellipsis(10)}&lt;/option&gt;&lt;/tpl&gt;',\n\t'&lt;/select&gt;'\n);\n \n// then append, applying the master template values\n </code></pre>\n\nSupported features:\n\n Tags:\n\n<pre><code>\n      {a_variable} - output encoded.\n      {a_variable.format:(\"Y-m-d\")} - call a method on the variable\n      {a_variable:raw} - unencoded output\n      {a_variable:toFixed(1,2)} - Roo.util.Format.\"toFixed\"\n      {a_variable:this.method_on_template(...)} - call a method on the template object.\n \n</code></pre>\n The tpl tag:\n<pre><code>\n        &lt;tpl for=\"a_variable or condition..\"&gt;&lt;/tpl&gt;\n        &lt;tpl if=\"a_variable or condition\"&gt;&lt;/tpl&gt;\n        &lt;tpl exec=\"some javascript\"&gt;&lt;/tpl&gt;\n        &lt;tpl name=\"named_template\"&gt;&lt;/tpl&gt; (experimental)\n  \n        &lt;tpl for=\".\"&gt;&lt;/tpl&gt; - just iterate the property..\n        &lt;tpl for=\"..\"&gt;&lt;/tpl&gt; - iterates with the parent (probably the template) \n</code></pre>",
7   "isSingleton" : false,
8   "isStatic" : false,
9   "isBuiltin" : false,
10   "memberOf" : "XTemplate",
11   "example" : "",
12   "deprecated" : "",
13   "since" : "",
14   "see" : "",
15   "params" : [],
16   "returns" : [],
17   "config" : [
18     {
19       "name" : "html",
20       "type" : "String",
21       "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")",
22       "memberOf" : "Roo.Template",
23       "optvals" : []
24     },
25     {
26       "name" : "url",
27       "type" : "String",
28       "desc" : "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..\n                   it should be fixed so that template is observable...",
29       "memberOf" : "Roo.Template",
30       "optvals" : []
31     }
32   ],
33   "methods" : [
34     {
35       "name" : "applySubTemplate",
36       "desc" : "same as applyTemplate, except it's done to one of the subTemplates\nwhen using named templates, you can do:\n\nvar str = pl.applySubTemplate('your-name', values);",
37       "isStatic" : false,
38       "isConstructor" : false,
39       "isPrivate" : false,
40       "memberOf" : "Roo.XTemplate",
41       "example" : "",
42       "deprecated" : "",
43       "since" : "",
44       "see" : "",
45       "params" : [
46         {
47           "name" : "id",
48           "type" : "Number",
49           "desc" : "of the template",
50           "isOptional" : false
51         },
52         {
53           "name" : "values",
54           "type" : "Object",
55           "desc" : "to apply to template",
56           "isOptional" : false
57         },
58         {
59           "name" : "parent",
60           "type" : "Object",
61           "desc" : "(normaly the instance of this object)",
62           "isOptional" : false
63         }
64       ],
65       "returns" : []
66     },
67     {
68       "name" : "compile",
69       "desc" : "compile the template\n\nThis is not recursive, so I'm not sure how nested templates are really going to be handled..",
70       "isStatic" : false,
71       "isConstructor" : false,
72       "isPrivate" : false,
73       "memberOf" : "Roo.XTemplate",
74       "example" : "",
75       "deprecated" : "",
76       "since" : "",
77       "see" : "",
78       "params" : [],
79       "returns" : []
80     },
81     {
82       "name" : "insertFirst",
83       "desc" : "Applies the supplied values to the template and inserts the new node(s) as the first child of el.",
84       "isStatic" : false,
85       "isConstructor" : false,
86       "isPrivate" : false,
87       "memberOf" : "Roo.Template",
88       "example" : "",
89       "deprecated" : "",
90       "since" : "",
91       "see" : "",
92       "params" : [
93         {
94           "name" : "el",
95           "type" : "String/HTMLElement/Roo.Element",
96           "desc" : "The context element",
97           "isOptional" : false
98         },
99         {
100           "name" : "values",
101           "type" : "Object",
102           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
103           "isOptional" : false
104         },
105         {
106           "name" : "returnElement",
107           "type" : "Boolean",
108           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
109           "isOptional" : false
110         }
111       ],
112       "returns" : [
113         {
114           "name" : "",
115           "type" : "HTMLElement/Roo.Element",
116           "desc" : "The new node or Element"
117         }
118       ]
119     },
120     {
121       "name" : "overwrite",
122       "desc" : "Applies the supplied values to the template and overwrites the content of el with the new node(s).",
123       "isStatic" : false,
124       "isConstructor" : false,
125       "isPrivate" : false,
126       "memberOf" : "Roo.Template",
127       "example" : "",
128       "deprecated" : "",
129       "since" : "",
130       "see" : "",
131       "params" : [
132         {
133           "name" : "el",
134           "type" : "String/HTMLElement/Roo.Element",
135           "desc" : "The context element",
136           "isOptional" : false
137         },
138         {
139           "name" : "values",
140           "type" : "Object",
141           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
142           "isOptional" : false
143         },
144         {
145           "name" : "returnElement",
146           "type" : "Boolean",
147           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
148           "isOptional" : false
149         }
150       ],
151       "returns" : [
152         {
153           "name" : "",
154           "type" : "HTMLElement/Roo.Element",
155           "desc" : "The new node or Element"
156         }
157       ]
158     },
159     {
160       "name" : "insertBefore",
161       "desc" : "Applies the supplied values to the template and inserts the new node(s) before el.",
162       "isStatic" : false,
163       "isConstructor" : false,
164       "isPrivate" : false,
165       "memberOf" : "Roo.Template",
166       "example" : "",
167       "deprecated" : "",
168       "since" : "",
169       "see" : "",
170       "params" : [
171         {
172           "name" : "el",
173           "type" : "String/HTMLElement/Roo.Element",
174           "desc" : "The context element",
175           "isOptional" : false
176         },
177         {
178           "name" : "values",
179           "type" : "Object",
180           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
181           "isOptional" : false
182         },
183         {
184           "name" : "returnElement",
185           "type" : "Boolean",
186           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
187           "isOptional" : false
188         }
189       ],
190       "returns" : [
191         {
192           "name" : "",
193           "type" : "HTMLElement/Roo.Element",
194           "desc" : "The new node or Element"
195         }
196       ]
197     },
198     {
199       "name" : "applyTemplate",
200       "desc" : "Returns an HTML fragment of this template with the specified values applied.",
201       "isStatic" : false,
202       "isConstructor" : false,
203       "isPrivate" : false,
204       "memberOf" : "Roo.Template",
205       "example" : "",
206       "deprecated" : "",
207       "since" : "",
208       "see" : "",
209       "params" : [
210         {
211           "name" : "values",
212           "type" : "Object",
213           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
214           "isOptional" : false
215         }
216       ],
217       "returns" : [
218         {
219           "name" : "",
220           "type" : "String",
221           "desc" : "The HTML fragment"
222         }
223       ]
224     },
225     {
226       "name" : "set",
227       "desc" : "Sets the HTML used as the template and optionally compiles it.",
228       "isStatic" : false,
229       "isConstructor" : false,
230       "isPrivate" : false,
231       "memberOf" : "Roo.Template",
232       "example" : "",
233       "deprecated" : "",
234       "since" : "",
235       "see" : "",
236       "params" : [
237         {
238           "name" : "html",
239           "type" : "String",
240           "desc" : "",
241           "isOptional" : false
242         },
243         {
244           "name" : "compile",
245           "type" : "Boolean",
246           "desc" : "(optional) True to compile the template (defaults to undefined)",
247           "isOptional" : false
248         }
249       ],
250       "returns" : [
251         {
252           "name" : "",
253           "type" : "Roo.Template",
254           "desc" : "this"
255         }
256       ]
257     },
258     {
259       "name" : "from",
260       "desc" : "Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.",
261       "isStatic" : true,
262       "isConstructor" : false,
263       "isPrivate" : false,
264       "memberOf" : "Roo.Template",
265       "example" : "",
266       "deprecated" : "",
267       "since" : "",
268       "see" : "",
269       "params" : [
270         {
271           "name" : "el",
272           "type" : "String/HTMLElement",
273           "desc" : "A DOM element or its id",
274           "isOptional" : false
275         }
276       ],
277       "returns" : []
278     },
279     {
280       "name" : "insertAfter",
281       "desc" : "Applies the supplied values to the template and inserts the new node(s) after el.",
282       "isStatic" : false,
283       "isConstructor" : false,
284       "isPrivate" : false,
285       "memberOf" : "Roo.Template",
286       "example" : "",
287       "deprecated" : "",
288       "since" : "",
289       "see" : "",
290       "params" : [
291         {
292           "name" : "el",
293           "type" : "String/HTMLElement/Roo.Element",
294           "desc" : "The context element",
295           "isOptional" : false
296         },
297         {
298           "name" : "values",
299           "type" : "Object",
300           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
301           "isOptional" : false
302         },
303         {
304           "name" : "returnElement",
305           "type" : "Boolean",
306           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
307           "isOptional" : false
308         }
309       ],
310       "returns" : [
311         {
312           "name" : "",
313           "type" : "HTMLElement/Roo.Element",
314           "desc" : "The new node or Element"
315         }
316       ]
317     },
318     {
319       "name" : "append",
320       "desc" : "Applies the supplied values to the template and appends the new node(s) to el.",
321       "isStatic" : false,
322       "isConstructor" : false,
323       "isPrivate" : false,
324       "memberOf" : "Roo.Template",
325       "example" : "",
326       "deprecated" : "",
327       "since" : "",
328       "see" : "",
329       "params" : [
330         {
331           "name" : "el",
332           "type" : "String/HTMLElement/Roo.Element",
333           "desc" : "The context element",
334           "isOptional" : false
335         },
336         {
337           "name" : "values",
338           "type" : "Object",
339           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
340           "isOptional" : false
341         },
342         {
343           "name" : "returnElement",
344           "type" : "Boolean",
345           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
346           "isOptional" : false
347         }
348       ],
349       "returns" : [
350         {
351           "name" : "",
352           "type" : "HTMLElement/Roo.Element",
353           "desc" : "The new node or Element"
354         }
355       ]
356     },
357     {
358       "name" : "apply",
359       "desc" : "Alias for {@link #applyTemplate}",
360       "isStatic" : false,
361       "isConstructor" : false,
362       "isPrivate" : false,
363       "memberOf" : "Roo.Template",
364       "example" : "",
365       "deprecated" : "",
366       "since" : "",
367       "see" : "",
368       "params" : [],
369       "returns" : []
370     }
371   ],
372   "events" : []
373 }