Represents an HTML fragment template. Templates may be precompiled for greater performance.
An instance of this class may be created by passing to the constructor either a single argument, or multiple arguments:var t = new Ext.Template("<div>Hello {0}.</div>");
t.append('some-element', ['foo']);
join('')
.
var t = new Ext.Template([
'<div name="{id}">',
'<span class="{cls}">{name:trim} {value:ellipsis(10)}</span>',
'</div>',
]);
t.compile();
t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});
join('')
.
var t = new Ext.Template(
'<div name="{id}">',
'<span class="{cls}">{name} {value}</span>',
'</div>',
// a configuration object:
{
compiled: true, // compile immediately
}
);
Notes:
disableFormats
are not applicable for Sencha Touch.disableFormats
reduces apply
time
when no formatting is required.values
to the template and appends
the new node(s) to the specified el
.
For example usage see the constructor.
{0}
)
or an object (i.e. {foo: 'bar'}
).values
applied.{0}
)
or an object (i.e. {foo: 'bar'}
).