d1c4cce64677ce40e65f9511c95a32f95aa66557
[roojs1] / docs / symbols / Roo.Template.json
1 {
2   "name" : "Roo.Template",
3   "augments" : [],
4   "desc" : "Represents an HTML fragment template. Templates can be precompiled for greater performance.\nFor a list of available format functions, see {@link Roo.util.Format}.<br />\nUsage:\n<pre><code>\nvar t = new Roo.Template({\n    html :  '&lt;div name=\"{id}\"&gt;' + \n        '&lt;span class=\"{cls}\"&gt;{name:trim} {someval:this.myformat}{value:ellipsis(10)}&lt;/span&gt;' +\n        '&lt;/div&gt;',\n    myformat: function (value, allValues) {\n        return 'XX' + value;\n    }\n});\nt.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});\n</code></pre>\nFor more information see this blog post with examples:\n <a href=\"http://www.cnitblog.com/seeyeah/archive/2011/12/30/38728.html/\">DomHelper\n     - Create Elements using DOM, HTML fragments and Templates</a>.",
5   "isSingleton" : false,
6   "isStatic" : false,
7   "isBuiltin" : false,
8   "memberOf" : "Template",
9   "example" : "",
10   "deprecated" : "",
11   "since" : "",
12   "see" : "",
13   "params" : [
14     {
15       "name" : "cfg",
16       "type" : "Object",
17       "desc" : "- Configuration object.",
18       "isOptional" : false
19     }
20   ],
21   "returns" : [],
22   "config" : [
23     {
24       "name" : "html",
25       "type" : "String",
26       "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")",
27       "memberOf" : "Roo.Template",
28       "optvals" : []
29     },
30     {
31       "name" : "url",
32       "type" : "String",
33       "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...",
34       "memberOf" : "Roo.Template",
35       "optvals" : []
36     }
37   ],
38   "methods" : [
39     {
40       "name" : "insertFirst",
41       "desc" : "Applies the supplied values to the template and inserts the new node(s) as the first child of el.",
42       "isStatic" : false,
43       "isConstructor" : false,
44       "isPrivate" : false,
45       "memberOf" : "Roo.Template",
46       "example" : "",
47       "deprecated" : "",
48       "since" : "",
49       "see" : "",
50       "params" : [
51         {
52           "name" : "el",
53           "type" : "String/HTMLElement/Roo.Element",
54           "desc" : "The context element",
55           "isOptional" : false
56         },
57         {
58           "name" : "values",
59           "type" : "Object",
60           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
61           "isOptional" : false
62         },
63         {
64           "name" : "returnElement",
65           "type" : "Boolean",
66           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
67           "isOptional" : false
68         }
69       ],
70       "returns" : [
71         {
72           "name" : "",
73           "type" : "HTMLElement/Roo.Element",
74           "desc" : "The new node or Element"
75         }
76       ]
77     },
78     {
79       "name" : "overwrite",
80       "desc" : "Applies the supplied values to the template and overwrites the content of el with the new node(s).",
81       "isStatic" : false,
82       "isConstructor" : false,
83       "isPrivate" : false,
84       "memberOf" : "Roo.Template",
85       "example" : "",
86       "deprecated" : "",
87       "since" : "",
88       "see" : "",
89       "params" : [
90         {
91           "name" : "el",
92           "type" : "String/HTMLElement/Roo.Element",
93           "desc" : "The context element",
94           "isOptional" : false
95         },
96         {
97           "name" : "values",
98           "type" : "Object",
99           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
100           "isOptional" : false
101         },
102         {
103           "name" : "returnElement",
104           "type" : "Boolean",
105           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
106           "isOptional" : false
107         }
108       ],
109       "returns" : [
110         {
111           "name" : "",
112           "type" : "HTMLElement/Roo.Element",
113           "desc" : "The new node or Element"
114         }
115       ]
116     },
117     {
118       "name" : "insertBefore",
119       "desc" : "Applies the supplied values to the template and inserts the new node(s) before el.",
120       "isStatic" : false,
121       "isConstructor" : false,
122       "isPrivate" : false,
123       "memberOf" : "Roo.Template",
124       "example" : "",
125       "deprecated" : "",
126       "since" : "",
127       "see" : "",
128       "params" : [
129         {
130           "name" : "el",
131           "type" : "String/HTMLElement/Roo.Element",
132           "desc" : "The context element",
133           "isOptional" : false
134         },
135         {
136           "name" : "values",
137           "type" : "Object",
138           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
139           "isOptional" : false
140         },
141         {
142           "name" : "returnElement",
143           "type" : "Boolean",
144           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
145           "isOptional" : false
146         }
147       ],
148       "returns" : [
149         {
150           "name" : "",
151           "type" : "HTMLElement/Roo.Element",
152           "desc" : "The new node or Element"
153         }
154       ]
155     },
156     {
157       "name" : "applyTemplate",
158       "desc" : "Returns an HTML fragment of this template with the specified values applied.",
159       "isStatic" : false,
160       "isConstructor" : false,
161       "isPrivate" : false,
162       "memberOf" : "Roo.Template",
163       "example" : "",
164       "deprecated" : "",
165       "since" : "",
166       "see" : "",
167       "params" : [
168         {
169           "name" : "values",
170           "type" : "Object",
171           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
172           "isOptional" : false
173         }
174       ],
175       "returns" : [
176         {
177           "name" : "",
178           "type" : "String",
179           "desc" : "The HTML fragment"
180         }
181       ]
182     },
183     {
184       "name" : "compile",
185       "desc" : "Compiles the template into an internal function, eliminating the RegEx overhead.",
186       "isStatic" : false,
187       "isConstructor" : false,
188       "isPrivate" : false,
189       "memberOf" : "Roo.Template",
190       "example" : "",
191       "deprecated" : "",
192       "since" : "",
193       "see" : "",
194       "params" : [],
195       "returns" : [
196         {
197           "name" : "",
198           "type" : "Roo.Template",
199           "desc" : "this"
200         }
201       ]
202     },
203     {
204       "name" : "set",
205       "desc" : "Sets the HTML used as the template and optionally compiles it.",
206       "isStatic" : false,
207       "isConstructor" : false,
208       "isPrivate" : false,
209       "memberOf" : "Roo.Template",
210       "example" : "",
211       "deprecated" : "",
212       "since" : "",
213       "see" : "",
214       "params" : [
215         {
216           "name" : "html",
217           "type" : "String",
218           "desc" : "",
219           "isOptional" : false
220         },
221         {
222           "name" : "compile",
223           "type" : "Boolean",
224           "desc" : "(optional) True to compile the template (defaults to undefined)",
225           "isOptional" : false
226         }
227       ],
228       "returns" : [
229         {
230           "name" : "",
231           "type" : "Roo.Template",
232           "desc" : "this"
233         }
234       ]
235     },
236     {
237       "name" : "from",
238       "desc" : "Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.",
239       "isStatic" : true,
240       "isConstructor" : false,
241       "isPrivate" : false,
242       "memberOf" : "Roo.Template",
243       "example" : "",
244       "deprecated" : "",
245       "since" : "",
246       "see" : "",
247       "params" : [
248         {
249           "name" : "el",
250           "type" : "String/HTMLElement",
251           "desc" : "A DOM element or its id",
252           "isOptional" : false
253         }
254       ],
255       "returns" : []
256     },
257     {
258       "name" : "insertAfter",
259       "desc" : "Applies the supplied values to the template and inserts the new node(s) after el.",
260       "isStatic" : false,
261       "isConstructor" : false,
262       "isPrivate" : false,
263       "memberOf" : "Roo.Template",
264       "example" : "",
265       "deprecated" : "",
266       "since" : "",
267       "see" : "",
268       "params" : [
269         {
270           "name" : "el",
271           "type" : "String/HTMLElement/Roo.Element",
272           "desc" : "The context element",
273           "isOptional" : false
274         },
275         {
276           "name" : "values",
277           "type" : "Object",
278           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
279           "isOptional" : false
280         },
281         {
282           "name" : "returnElement",
283           "type" : "Boolean",
284           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
285           "isOptional" : false
286         }
287       ],
288       "returns" : [
289         {
290           "name" : "",
291           "type" : "HTMLElement/Roo.Element",
292           "desc" : "The new node or Element"
293         }
294       ]
295     },
296     {
297       "name" : "append",
298       "desc" : "Applies the supplied values to the template and appends the new node(s) to el.",
299       "isStatic" : false,
300       "isConstructor" : false,
301       "isPrivate" : false,
302       "memberOf" : "Roo.Template",
303       "example" : "",
304       "deprecated" : "",
305       "since" : "",
306       "see" : "",
307       "params" : [
308         {
309           "name" : "el",
310           "type" : "String/HTMLElement/Roo.Element",
311           "desc" : "The context element",
312           "isOptional" : false
313         },
314         {
315           "name" : "values",
316           "type" : "Object",
317           "desc" : "The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})",
318           "isOptional" : false
319         },
320         {
321           "name" : "returnElement",
322           "type" : "Boolean",
323           "desc" : "(optional) true to return a Roo.Element (defaults to undefined)",
324           "isOptional" : false
325         }
326       ],
327       "returns" : [
328         {
329           "name" : "",
330           "type" : "HTMLElement/Roo.Element",
331           "desc" : "The new node or Element"
332         }
333       ]
334     },
335     {
336       "name" : "apply",
337       "desc" : "Alias for {@link #applyTemplate}",
338       "isStatic" : false,
339       "isConstructor" : false,
340       "isPrivate" : false,
341       "memberOf" : "Roo.Template",
342       "example" : "",
343       "deprecated" : "",
344       "since" : "",
345       "see" : "",
346       "params" : [],
347       "returns" : []
348     }
349   ],
350   "events" : []
351 }