这是我的Sencha观点:
Ext.application({
name: 'Sencha',
launch: function() {
var panel = new Ext.Panel({
fullscreen: true,
dockedItems: [
{
xtype: "label",
dock: "top",
html: "<div style='backbround'>KK TEST",
style: "width:100%;text-align:center;font-weight:bold"
},
{
xtype: "toolbar",
items: [
{
iconMask: true,
iconCls: "download"
},
{
iconMask: true,
iconCls: "favorites"
},
{
iconMask: true,
iconCls: "search"
},
{
iconMask: true,
iconCls: "user"
}
]
},
{
xtype: 'list',
itemTpl: '{title}',
store: {
fields: ['title', 'url'],
data: [
{title: 'Locate a centre', url: 'ext-scheduler-2-0-upgrading-to-ext-js-4'},
{title: '<a href="/centres" style="color:#FFFFFF;text-decoration:none;">Browse all kwikkopy centres</a>', url: 'sencha-touch-2-what-to-expect'},
{title: 'Sencha Con 2011', url: 'senchacon-2011-now-packed-with-more-goodness'},
{title: 'Documentation in Ext JS 4', url: 'new-ext-js-4-documentation-center'}
]
},
itemConfig: {
tpl: '{url}'
},
listeners: {
select: function(itemConfig) {
console.log(store)
alert('tapped on '+ itemConfig )
}
}
}
]
}); }
});
当我点击列表项时,我想调用一个控制器并重定向到下一页。 我该怎么做?
答案 0 :(得分:0)
更改您的侦听器配置:
listeners:{
itemtap:function(data,index){
var record = data.getStore().getAt(index);
// the record that has been clicked.
Ext.dispatch({
controller: 'ControllerName'
,action: 'ControllerMethod'
,record: record
});
}
}