Package: | Roo |
Defined In: | Roo/Template.js. |
Class: | Template |
Subclasses: | Roo.DomTemplate, Roo.MasterTemplate, Roo.XTemplate |
var t = new Roo.Template({
html : '<div name="{id}">' +
'<span class="{cls}">{name:trim} {someval:this.myformat}{value:ellipsis(10)}</span>' +
'</div>',
myformat: function (value, allValues) {
return 'XX' + value;
}
});
t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});
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.Template
(Object cfg)
Create a new Roo.Template
Create a new Roo.Template
|
||
Roo.Template.from
(String/HTMLElement el)
Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML.
Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML.
|
Roo.Template | |
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 | |
Returns an HTML fragment of this template with the specified values applied.
|
Roo.Template | |
compile
()
:
Roo.Template
Compiles the template into an internal function, eliminating the RegEx overhead.
Compiles the template into an internal function, eliminating the RegEx overhead.
|
Roo.Template | |
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 |