PDA

View Full Version : How to create image action button through groupHeaderTpl



DineshGudikandula
12 Jul 2012, 10:56 PM
How to create image action button through groupHeaderTpl based on condition like if the condition is true then only it will show otherwise not.plz make help

tvanzoelen
12 Jul 2012, 11:27 PM
It seems you can use functions within the template.



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 == 'Aubrey' || name == 'Nikol';
},
isBaby: function(age){
return age < 1;
}
}
);