Reputation: 168
Is there any way to make something like the following?
var template=new Ext.XTemplate(
'<tpl for=".">',
'<div>'
'<span>This is a Test number {id}</span>'
'<script>doSomething()</script>',
'</div>',
'</tpl>');
By doing that, i just receive the HTML with the script tags, but they are not executed. Any idea?
Upvotes: 0
Views: 614
Reputation: 8269
If you want to run javascript code while generating html by template, you can do the following:
var template=new Ext.XTemplate(
'<tpl for=".">',
'<div>'
'<span>This is a Test number {id}</span>'
'{[this.doSomething()]}',
'</div>',
'</tpl>',
{
doSomething: function(){}
});
Upvotes: 1