Roo.Template Roo.XTemplate
Package: | Roo |
Defined In: | Roo/XTemplate.js. |
Class: | XTemplate |
Extends: | Roo.Template |
var t = new Roo.XTemplate(
'<select name="{name}">',
'<tpl for="options"><option value="{value:trim}">{text:ellipsis(10)}</option></tpl>',
'</select>'
);
// then append, applying the master template values
{a_variable} - output encoded.
{a_variable.format:("Y-m-d")} - call a method on the variable
{a_variable:raw} - unencoded output
{a_variable:toFixed(1,2)} - Roo.util.Format."toFixed"
{a_variable:this.method_on_template(...)} - call a method on the template object.
<tpl for="a_variable or condition.."></tpl>
<tpl if="a_variable or condition"></tpl>
<tpl exec="some javascript"></tpl>
<tpl name="named_template"></tpl> (experimental)
<tpl for="."></tpl> - just iterate the property..
<tpl for=".."></tpl> - iterates with the parent (probably the template)
Options | Defined By | |
---|---|---|
html : String
The HTML fragment or an array of fragments to join("") or multiple arguments to join("")
The HTML fragment or an array of fragments to join("") or multiple arguments to join("")
|
Roo.Template | |
url : String
The Url to load the template from.
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..
it should be fixed so that template is observable... |
Roo.Template |
Method | Defined By | |
---|---|---|
new Roo.XTemplate
()
Create a new Roo.XTemplate
Create a new Roo.XTemplate
|
||
append
(String/HTMLElement/Roo.Element el, Object values, Boolean returnElement)
:
HTMLElement/Roo.Element
Applies the supplied values to the template and appends the new node(s) to el.
Applies the supplied values to the template and appends the new node(s) to el.
|
Roo.Template | |
apply
()
Alias for {link applyTemplate}
Alias for {link applyTemplate}
|
Roo.Template | |
same as applyTemplate, except it's done to one of the subTemplates
when using named templates, you can do: var str = pl.applySubTemplate('your-name', values); |
Roo.XTemplate | |
Returns an HTML fragment of this template with the specified values applied.
|
Roo.Template | |
compile
()
compile the template
This is not recursive, so I'm not sure how nested templates are really going to be handled.
compile the template
This is not recursive, so I'm not sure how nested templates are really going to be handled.. |
Roo.XTemplate | |
insertAfter
(String/HTMLElement/Roo.Element el, Object values, Boolean returnElement)
:
HTMLElement/Roo.Element
Applies the supplied values to the template and inserts the new node(s) after el.
Applies the supplied values to the template and inserts the new node(s) after el.
|
Roo.Template | |
insertBefore
(String/HTMLElement/Roo.Element el, Object values, Boolean returnElement)
:
HTMLElement/Roo.Element
Applies the supplied values to the template and inserts the new node(s) before el.
Applies the supplied values to the template and inserts the new node(s) before el.
|
Roo.Template | |
insertFirst
(String/HTMLElement/Roo.Element el, Object values, Boolean returnElement)
:
HTMLElement/Roo.Element
Applies the supplied values to the template and inserts the new node(s) as the first child of el.
Applies the supplied values to the template and inserts the new node(s) as the first child of el.
|
Roo.Template | |
overwrite
(String/HTMLElement/Roo.Element el, Object values, Boolean returnElement)
:
HTMLElement/Roo.Element
Applies the supplied values to the template and overwrites the content of el with the new node(s).
Applies the supplied values to the template and overwrites the content of el with the new node(s).
|
Roo.Template | |
Sets the HTML used as the template and optionally compiles it.
Sets the HTML used as the template and optionally compiles it.
|
Roo.Template |