我有一个 Ext.data.Store 和一个带有列表的 Ext.Panel。我使用以下命令动态添加记录:
myStore.add({txt: r});
我想添加一个侦听器,当我单击列表记录时,它会在消息框中显示记录数据。
我该怎么做?
扩展数据存储
var myStore = Ext.create('Ext.data.Store', {
storeId: 'MyStore',
fields: ['txt']
}); // create()
扩展面板
listpanel = new Ext.Panel({
layout: 'fit', // important to make layout as 'fit'
items: [
{
xtype: 'titlebar',
id: 'myTitle',
docked: 'top',
title: 'Before Change title'
},
{
//Definition of the list
xtype: 'list',
itemTpl: '{txt}',
store: myStore,
}]
});