调试一些 Sencha Touch 2 代码,我把它归结为这个。为什么这不起作用?更重要的是,为什么不呢?明明view、listOne、listTwo都在范围内,但是点击listOne item,然后返回,再点击listOne item第二次会报错。导航视图返回时是否会删除引用?
var view = Ext.create('Ext.NavigationView', {
xtype:'myview',
fullscreen: true
});
var listTwo = Ext.create('Ext.List', {
store: {
fields: ['name'],
data: [
{name: 'Doeth'},
{name: 'Smith'},
{name: 'Johnson'},
{name: 'Stevens'}
]
},
itemTpl: '{name}'
});
var listOne = Ext.create('Ext.List', {
store: {
fields: ['name'],
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
},
itemTpl: '{name}',
listeners: {
itemtap: function (me, index, target, record, e, eOpts ){
view.push(listTwo);
}
}
});
Ext.Viewport.add(view);
view.push(listOne);