Sencha触摸模板附加教程

时间:2011-10-15 00:06:20

标签: templates sencha-touch store

我的列表如下所示:

var list = new Ext.List({
   fullscreen: true,    
   itemTpl : '{firstName} {lastName}',   
   store: store
});

和这样的模型和商店:

Ext.regModel('Contact', {
   fields: ['firstName', 'lastName']
});

var store = new Ext.data.JsonStore({
      model  : 'Contact',
   },
   data: [
      {firstName: 'Tommy',   lastName: 'Maintz'},
      {firstName: 'Rob',     lastName: 'Dougan'},
      {firstName: 'Ed',      lastName: 'Spencer'},

  ]
});

如何在列表中追加我的itemTpl或在初始化后覆盖它?

1 个答案:

答案 0 :(得分:2)

*编辑以反映问题*

我会猜测这个技巧:

list.itemTpl = '{firstName} {lastName} Test Test Test';
list.initComponent();
list.refresh();

当您使用Sencha Touch 2(在我的应用中测试)

list.setItemTpl( '{firstName} {lastName} Test Test Test' );
list.refresh();