Ok, two things you have to remember
- You cannot use a complicated object inside of the tpl in the manner you just did. In Sencha Touch, adding a "," followed by a "{ . . . }" after the tpl strings implies adding member functions or configurations to your XTemplate. In this case, ST misunderstood your object to be a member function of sorts, and didn't display anything since you didnt call any function.
Example of member functions ::
var tpl = new Ext.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="this.isGirl(name)">',
'<p>Girl: {name} - {age}</p>',
'<tpl else>',
'<p>Boy: {name} - {age}</p>',
'</tpl>',
'<tpl if="this.isBaby(age)">',
'<p>{name} is a baby!</p>',
'</tpl>',
'</tpl></p>',
{
// XTemplate configuration:
disableFormats: true,
// member functions:
isGirl: function(name){
return name == 'Sara Grace';
},
isBaby: function(age){
return age < 1;
}
}
);
If you have a complex tpl object, always try to create a separate XTemplate object instead, that will make your code simple and beautiful (ie easy to read)
I have done something similar and added videos to my XTemplate before. But I haven't used the video object. Instead, my tpl that I created looks as follows ::
In my scenario, the url of my video was composed of two parts, vurl1 was something common like "www.youtube.com/watch?" and the vcode1 was the dynamic code that followed.