sync
[roojs1] / docs / symbols / Roo.XTemplate.json
1 {
2   "name" : "Roo.XTemplate",
3   "augments" : [
4     "Roo.Template"
5   ],
6   "childClasses" : [],
7   "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>",
8   "isSingleton" : false,
9   "isStatic" : false,
10   "isBuiltin" : false,
11   "memberOf" : "XTemplate",
12   "example" : "",
13   "deprecated" : "",
14   "since" : "",
15   "see" : "",
16   "params" : [],
17   "returns" : [],
18   "throws" : "",
19   "requires" : "",
20   "config" : [
21     {
22       "name" : "onLoad",
23       "type" : "Function",
24       "desc" : "Called after the template has been loaded and complied (usually from a remove source)",
25       "memberOf" : "Roo.Template"
26     },
27     {
28       "name" : "html",
29       "type" : "String",
30       "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")",
31       "memberOf" : "Roo.Template"
32     },
33     {
34       "name" : "url",
35       "type" : "String",
36       "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...",
37       "memberOf" : "Roo.Template"
38     }
39   ],
40   "methods" : [
41     {
42       "name" : "applySubTemplate",
43       "type" : "function",
44       "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);",
45       "sig" : "(id, values, parent)",
46       "static" : false,
47       "memberOf" : "",
48       "isStatic" : false,
49       "isConstructor" : false,
50       "isPrivate" : false,
51       "example" : "",
52       "deprecated" : "",
53       "since" : "",
54       "see" : "",
55       "exceptions" : "",
56       "requires" : "",
57       "params" : [
58         {
59           "name" : "id",
60           "type" : "Number",
61           "desc" : "of the template",
62           "isOptional" : false
63         },
64         {
65           "name" : "values",
66           "type" : "Object",
67           "desc" : "to apply to template",
68           "isOptional" : false
69         },
70         {
71           "name" : "parent",
72           "type" : "Object",
73           "desc" : "(normaly the instance of this object)",
74           "isOptional" : false
75         }
76       ],
77       "returns" : []
78     },
79     {
80       "name" : "compile",
81       "type" : "function",
82       "desc" : "compile the template\n\nThis is not recursive, so I'm not sure how nested templates are really going to be handled..",
83       "sig" : "()\n{\n\n}",
84       "static" : false,
85       "memberOf" : "",
86       "isStatic" : false,
87       "isConstructor" : false,
88       "isPrivate" : false,
89       "example" : "",
90       "deprecated" : "",
91       "since" : "",
92       "see" : "",
93       "exceptions" : "",
94       "requires" : "",
95       "params" : [],
96       "returns" : []
97     },
98     {
99       "name" : "insertFirst",
100       "type" : "function",
101       "desc" : "Applies the supplied values to the template and inserts the new node(s) as the first child of el.",
102       "sig" : "(el, values, returnElement)",
103       "static" : false,
104       "memberOf" : "Roo.Template",
105       "isStatic" : false,
106       "isConstructor" : false,
107       "isPrivate" : false,
108       "example" : "",
109       "deprecated" : "",
110       "since" : "",
111       "see" : "",
112       "exceptions" : "",
113       "requires" : "",
114       "params" : [
115         {
116           "name" : "el",
117           "type" : "String/HTMLElement/Roo.Element",
118           "desc" : "The context element",
119           "isOptional" : false
120         },
121         {
122           "name" : "values",
123           "type" : "Object",
124           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
125           "isOptional" : false
126         },
127         {
128           "name" : "returnElement",
129           "type" : "Boolean",
130           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
131           "isOptional" : false
132         }
133       ],
134       "returns" : [
135         {
136           "name" : "",
137           "type" : "HTMLElement/Roo.Element",
138           "desc" : "The new node or Element"
139         }
140       ]
141     },
142     {
143       "name" : "overwrite",
144       "type" : "function",
145       "desc" : "Applies the supplied values to the template and overwrites the content of el with the new node(s).",
146       "sig" : "(el, values, returnElement)",
147       "static" : false,
148       "memberOf" : "Roo.Template",
149       "isStatic" : false,
150       "isConstructor" : false,
151       "isPrivate" : false,
152       "example" : "",
153       "deprecated" : "",
154       "since" : "",
155       "see" : "",
156       "exceptions" : "",
157       "requires" : "",
158       "params" : [
159         {
160           "name" : "el",
161           "type" : "String/HTMLElement/Roo.Element",
162           "desc" : "The context element",
163           "isOptional" : false
164         },
165         {
166           "name" : "values",
167           "type" : "Object",
168           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
169           "isOptional" : false
170         },
171         {
172           "name" : "returnElement",
173           "type" : "Boolean",
174           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
175           "isOptional" : false
176         }
177       ],
178       "returns" : [
179         {
180           "name" : "",
181           "type" : "HTMLElement/Roo.Element",
182           "desc" : "The new node or Element"
183         }
184       ]
185     },
186     {
187       "name" : "insertBefore",
188       "type" : "function",
189       "desc" : "Applies the supplied values to the template and inserts the new node(s) before el.",
190       "sig" : "(el, values, returnElement)",
191       "static" : false,
192       "memberOf" : "Roo.Template",
193       "isStatic" : false,
194       "isConstructor" : false,
195       "isPrivate" : false,
196       "example" : "",
197       "deprecated" : "",
198       "since" : "",
199       "see" : "",
200       "exceptions" : "",
201       "requires" : "",
202       "params" : [
203         {
204           "name" : "el",
205           "type" : "String/HTMLElement/Roo.Element",
206           "desc" : "The context element",
207           "isOptional" : false
208         },
209         {
210           "name" : "values",
211           "type" : "Object",
212           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
213           "isOptional" : false
214         },
215         {
216           "name" : "returnElement",
217           "type" : "Boolean",
218           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
219           "isOptional" : false
220         }
221       ],
222       "returns" : [
223         {
224           "name" : "",
225           "type" : "HTMLElement/Roo.Element",
226           "desc" : "The new node or Element"
227         }
228       ]
229     },
230     {
231       "name" : "applyTemplate",
232       "type" : "function",
233       "desc" : "Returns an HTML fragment of this template with the specified values applied.",
234       "sig" : "(values)",
235       "static" : false,
236       "memberOf" : "Roo.Template",
237       "isStatic" : false,
238       "isConstructor" : false,
239       "isPrivate" : false,
240       "example" : "",
241       "deprecated" : "",
242       "since" : "",
243       "see" : "",
244       "exceptions" : "",
245       "requires" : "",
246       "params" : [
247         {
248           "name" : "values",
249           "type" : "Object",
250           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
251           "isOptional" : false
252         }
253       ],
254       "returns" : [
255         {
256           "name" : "",
257           "type" : "String",
258           "desc" : "The HTML fragment"
259         }
260       ]
261     },
262     {
263       "name" : "set",
264       "type" : "function",
265       "desc" : "Sets the HTML used as the template and optionally compiles it.",
266       "sig" : "(html, compile)",
267       "static" : false,
268       "memberOf" : "Roo.Template",
269       "isStatic" : false,
270       "isConstructor" : false,
271       "isPrivate" : false,
272       "example" : "",
273       "deprecated" : "",
274       "since" : "",
275       "see" : "",
276       "exceptions" : "",
277       "requires" : "",
278       "params" : [
279         {
280           "name" : "html",
281           "type" : "String",
282           "desc" : "",
283           "isOptional" : false
284         },
285         {
286           "name" : "compile",
287           "type" : "Boolean",
288           "desc" : "(optional) True to compile the template (defaults to undefined)",
289           "isOptional" : false
290         }
291       ],
292       "returns" : [
293         {
294           "name" : "",
295           "type" : "Roo.Template",
296           "desc" : "this"
297         }
298       ]
299     },
300     {
301       "name" : "from",
302       "type" : "function",
303       "desc" : "Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.",
304       "sig" : "(el)",
305       "static" : true,
306       "memberOf" : "Roo.Template",
307       "isStatic" : true,
308       "isConstructor" : false,
309       "isPrivate" : false,
310       "example" : "",
311       "deprecated" : "",
312       "since" : "",
313       "see" : "",
314       "exceptions" : "",
315       "requires" : "",
316       "params" : [
317         {
318           "name" : "el",
319           "type" : "String/HTMLElement",
320           "desc" : "A DOM element or its id",
321           "isOptional" : false
322         }
323       ],
324       "returns" : []
325     },
326     {
327       "name" : "insertAfter",
328       "type" : "function",
329       "desc" : "Applies the supplied values to the template and inserts the new node(s) after el.",
330       "sig" : "(el, values, returnElement)",
331       "static" : false,
332       "memberOf" : "Roo.Template",
333       "isStatic" : false,
334       "isConstructor" : false,
335       "isPrivate" : false,
336       "example" : "",
337       "deprecated" : "",
338       "since" : "",
339       "see" : "",
340       "exceptions" : "",
341       "requires" : "",
342       "params" : [
343         {
344           "name" : "el",
345           "type" : "String/HTMLElement/Roo.Element",
346           "desc" : "The context element",
347           "isOptional" : false
348         },
349         {
350           "name" : "values",
351           "type" : "Object",
352           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
353           "isOptional" : false
354         },
355         {
356           "name" : "returnElement",
357           "type" : "Boolean",
358           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
359           "isOptional" : false
360         }
361       ],
362       "returns" : [
363         {
364           "name" : "",
365           "type" : "HTMLElement/Roo.Element",
366           "desc" : "The new node or Element"
367         }
368       ]
369     },
370     {
371       "name" : "append",
372       "type" : "function",
373       "desc" : "Applies the supplied values to the template and appends the new node(s) to el.",
374       "sig" : "(el, values, returnElement)",
375       "static" : false,
376       "memberOf" : "Roo.Template",
377       "isStatic" : false,
378       "isConstructor" : false,
379       "isPrivate" : false,
380       "example" : "",
381       "deprecated" : "",
382       "since" : "",
383       "see" : "",
384       "exceptions" : "",
385       "requires" : "",
386       "params" : [
387         {
388           "name" : "el",
389           "type" : "String/HTMLElement/Roo.Element",
390           "desc" : "The context element",
391           "isOptional" : false
392         },
393         {
394           "name" : "values",
395           "type" : "Object",
396           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
397           "isOptional" : false
398         },
399         {
400           "name" : "returnElement",
401           "type" : "Boolean",
402           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
403           "isOptional" : false
404         }
405       ],
406       "returns" : [
407         {
408           "name" : "",
409           "type" : "HTMLElement/Roo.Element",
410           "desc" : "The new node or Element"
411         }
412       ]
413     },
414     {
415       "name" : "apply",
416       "type" : "function",
417       "desc" : "Alias for {@link #applyTemplate}",
418       "sig" : "()\n{\n\n}",
419       "static" : false,
420       "memberOf" : "Roo.Template",
421       "isStatic" : false,
422       "isConstructor" : false,
423       "isPrivate" : false,
424       "example" : "",
425       "deprecated" : "",
426       "since" : "",
427       "see" : "",
428       "exceptions" : "",
429       "requires" : "",
430       "params" : [],
431       "returns" : []
432     }
433   ],
434   "events" : []
435 }