0
我可以訪問控制器中的列表(作爲項目的容器),但我不知道如何訪問列表項屬性。列表組件:如何檢測哪個項目被選中?
如何創建正確的ComponentQuery規則?我嘗試了'list> item',但它不起作用。
每個項目都有它的標題,但在selectSection中我得到'undefined'作爲輸出。
Ext.define('UGP.controller.BeginList',
{
extend: 'Ext.app.Controller',
config:
{
views: [ 'BeginList' ],
control:
{
'list':
{
select: 'selectSection'
}
}
},
selectSection: function()
{
Ext.Msg.alert('title=' + this.title);
}
}
);
與List組件中BeginList.js:
Ext.define('UGP.view.BeginList',
{
extend: 'Ext.List',
config:
{
fullscreen: true,
itemTpl: '{title}',
data:
[
{ title: 'Chapter 1', id: 0, action: "selectSection" },
{ title: 'Chapter 2', id: 1, action: "selectSection" },
{ title: 'Chapter 3', id: 2, action: "selectSection" },
{ title: 'Chapter 4', id: 3, action: "selectSection" }
]
}
}
);