在列表项上点击搜索触摸调用控制器



我的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   )
          }
        }
      }
    ]
  });    }
});

我想调用一个控制器,并在单击列表项时重定向到下一页。我怎么做呢?

这样修改你的监听器配置:

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

最新更新