View Full Version : set html using Ext.XTemplate

18 Mar 2011, 5:36 AM

I know that the set() method doesn't work with Ext.XTemplate, but I was wondering if there would be a way of reusing the same XTemplate with different html blobs?

I am looping over a list of templates stored in the database to display an activity feed and I currently have to create a new XTemplate for each activity that I display, which isin't very efficient... (I don't have any performance issues yet tought...).

This is how I do it right now...

new Ext.XTemplate(
'<tpl for=".">{[this.getHtml(values.template, values)]}</tpl>',
getHtml: function(html, values) {
var textArea = document.createElement('textarea');
textArea.value = html;

return Ext.XTemplate.from(textArea).apply(values);