1
votes

is it possible to use "Template member functions" in sencha architect 2?

In sencha touch you can use them like this:

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;
    }
}
);

Can you provide an example of how to do it? Is there an alternative?

1

1 Answers

0
votes

What do you want use, Template or XTemplate? There are two types of templates provided: Template and XTemplate. Template provides us the basic template functionality, whereas XTemplate is much more advanced.

Templates additional capabilities such as conditions, loops, inline functions, and in-built variables offered by XTemplate to show the filtered items.

And I'm not fan Sencha Architect but can you do it. :) Ciao