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