2013-03-21 79 views
0

我的代码有问题。我想使用Sencha Touch DataView,一切正常,直到我尝试把初始化事件。当我把它,intialize事件,我的数据视图不能生成。这是我的代码。你可以帮我吗 :)?Sencha Touch的数据视图和初始化不一起工作

Ext.define("xxx.view.Spread", { 
extend: 'Ext.DataView', 
xtype: 'xxxspread', 
id: 'spreadForm', 
config : { 
    styleHtmlContent: true, 
    store: { 
     //autoLoad: true, 
     fields: ["name", "desc"], 
     data: [ 
      {name: 'test', desc: "testtest"}, 
      {name: 'test', desc: "test"}, 
     ], 
    }, 


    itemTpl: '<img src="https://si0.twimg.com/profile_images/1089012240/sencha-logo_normal.png" /><h1>{name}</h1><p>{desc}</p><div style="clear: both"></div>', 

}, 

initialize: function() { 
    console.log("init"); 
}, 


}); 

回答

3

你将不得不作出一个配置为您listeners,并赶上initialize事件出现。

config: { 
    styleHtmlContent: true, 
    store : ... 
    //More config here 
    listeners: { 
     initialize: function() { console.log('init'); } 
    } 
} 
+0

非常感谢你:) – 2013-03-23 12:06:13