2012-11-16 32 views

回答

1

好吧,看在文档中​​,它有一个listeners配置。
这里面的配置,你可以指定一个像itemtaphide事件。

让我们看看事件itemtap

itemtap(this, index, target, record, e, eOpts) 

它有6个参数,你可以使用。每个事件都有参数thiseOpts
在你的代码,它看起来像这样:

Ext.create('Ext.List', { 
    fullscreen: true, 
    itemTpl: '{title}', 
    data: [ 
    { title: 'Item 1' }, 
    { title: 'Item 2' }, 
    { title: 'Item 3' }, 
    { title: 'Item 4' } 
    ], 
    listeners: { 
    itemtap: function(cmp, index, target, record, e, eOpts){ 
     alert('Tapped on index: '+index); 
    } 
    } 
}); 

,当你点击你的列表中,好运:)东西这将提醒消息。