Sencha touch Sehch触摸列表项上的呼叫控制器点击

Sencha touch Sehch触摸列表项上的呼叫控制器点击,sencha-touch,Sencha Touch,以下是我的Sencha观点: Ext.application({ name: 'Sencha', launch: function() { var panel = new Ext.Panel({ fullscreen: true, dockedItems: [ { xtype: "label", dock: "top", html: "<div style='backbround'>KK TES

以下是我的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   )
          }
        }
      }
    ]
  });    }
});
Ext.application({
名称:"Sencha",,
启动:函数(){
var面板=新的外部面板({
全屏:对,
摘要:[
{
xtype:“标签”,
码头:“顶部”,
html:“KK测试”,
样式:“宽度:100%;文本对齐:居中;字体大小:粗体”
},
{
xtype:“工具栏”,
项目:[
{
是的,
iconCls:“下载”
},
{
是的,
iconCls:“收藏夹”
},
{
是的,
iconCls:“搜索”
},
{
是的,
iconCls:“用户”
}
]  
},
{
xtype:'列表',
itemTpl:“{title}”,
商店:{
字段:['title','url'],
数据:[
{title:'Locate a center',url:'ext-scheduler-2-0-upgrading-to-ext-js-4'},
{标题:'',url:'sencha-touch-2-what-to-expect'},
{标题:'Sencha Con 2011',网址:'senchacon-2011-now-packed-with-more-goodness'},
{title:'Documentation in Ext JS 4',url:'new-Ext-JS-4-Documentation-center'}
]
},
itemConfig:{
tpl:“{url}”
},
听众:{
选择:函数(itemConfig){
console.log(存储)
警报('点击'+itemConfig)
}
}
}
]
});    }
});
我想在单击列表项时调用控制器并重定向到下一页。
我如何做到这一点?

在以下情况下更改您的侦听器配置:

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
        });
    }
}

感谢您的回答和对问题的编辑。我像你说的那样更改了代码,现在它在调用
Ext.dispatch
时出错,说
uncaughttypeerror:Object#没有方法“dispatch”
你在使用sencha touch 2吗?如果是这样的话,这就是为什么Ext没有“dispatch”方法的原因,因为我还不熟悉ST2,所以我无法帮助您。如果您没有使用sencha touch,那么请检查是否包含sencha touch js文件,并检查在调用itemtap函数之前是否引发了另一个异常。但无论如何,您可能正在使用ST2:)