Question

So working though the mostly absent docs on templates - unable to get it to work.

Ext.define('MyAPp.view.Login', {
    extend: 'Ext.Component',
    xtype: 'welcomeLogin',
    config: {
        html: 'This shows',
        tpl:   Ext.create ('Ext.XTemplate', '<div>Please show something</div>', {
            compiled: true
       })
     }

});

Why does the template content now show? I have tried adding apply(), applyTemplate() on and on and on... Please help!!!

Was it helpful?

Solution

@ilija139 is right. you need to define the data property, even if it's empty.

data: {}

Edit: Also, the compile attribute isn't needed. It only applies to Ext.Templates not XTemplates (according to the docs). Works the same for me without compile

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top