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