Titouan de Bailleul
Titouan de Bailleul

Reputation: 12949

Unable to bind data to XTemplate

I'm trying to display data in a Panel with this simple example with Sencha Touch 2, but it's not working :

var planetEarth = {
    name: "Earth",
    mass: 1.00
};

var planetInfo = new Ext.XTemplate("<h2>{name}</h2>mass: {mass}");

var profile = Ext.create('Ext.Panel', {
  fullscreen: true,
  xtype: 'panel',
  layout: 'fit',
  data : planetEarth,
  tpl: planetInfo
});

Ext.Viewport.setActiveItem(profile);

Any idea why ?

Upvotes: 1

Views: 1313

Answers (1)

badsyntax
badsyntax

Reputation: 9650

Seems to work for me: http://www.senchafiddle.com/#KxGHo

[edit] To clarify, you need to wait until the document has finished loading before defining and executing any code that's used to build the user interface. Place your code in the application 'launch' method.

Upvotes: 1

Related Questions