2012-05-21 43 views
2

我的问题是...我有一个列表谁是由一家商店完成,这家商店来自代理(json)。当我列入清单中的一个项目时,我需要一个详细信息,而这个详细信息来自anothe json。列表之间的变量

例如:

ArtistList和ArtistDetail

,当我在artistList的项目点击我需要

http://localhost/json-detail/45 

打电话,如果我在另一个项目点击...

http://localhost/json-detail/50 etc... 

我的问题是,我不能发送参数到另一个视图... o [R也许错误是在我列出的概念...:S

这是我的列表视图:

var listaArtistas = { 
     xtype: 'list', 
     title: 'Artistas', 
     height: 240, 
     store: { 
      autoLoad: true, 
      fields: ['node'], 
      proxy: { 
       type: 'ajax', 
       url: 'http://localhost/json-artistas', 

       reader: { 
        type: 'json', 
        rootProperty: 'nodes' 
       } 
      } 
     }, 
     listeners: { 
      itemtap: function(lista,index,target,record,e,eOpts) 
      { 

       var artistDetail = new Ext.create('app.view.ArtistDetail'); 
       artistDetail.setArtistID('45'); 
       panelHomeNav.push(artistDetail); 

      } 
     }, 

     itemTpl: tpl 

     }; 

这是我的细节:

Ext.define('app.view.ArtistDetail',{ 
extend: 'Ext.Panel', 
xtype: 'artistdetail', 
style: "background-image:url('/resources/images/fondoartista.png');", 

config:{ 
    title: 'Artistas', 
    iconCls: 'star', 
    ArtistID: '', 
    items: 
    { 
     title: 'Artistas', 
     items: [artistDetailPanelContenedor] 
    } 
}}); 

而且需要像这样

var listaEspectaculo = { 
     xtype: 'list', 
     title: 'Artistas', 
     store: 
     { 
      autoLoad: true, 
      fields: ['node'], 
      proxy: { 
       type: 'ajax', 
       url: 'http://localhost/json-artistasdetail/'+getArtistID, <<<<<<<<<<------ PROBLEM 

       reader: { 
        type: 'json', 
        rootProperty: 'nodes' 
       } 
      } 
     }, 
     listeners: { 
      itemtap: function(lista,index,target,record,e,eOpts) 
      { 
       var eventDetail = new Ext.create('app.view.EventDetail'); 
       panelHomeNav.push(eventDetail);     
      } 
     },   
     itemTpl: tplEspectaculo 

}; 

THx求救!!!

回答

0

也许这可以帮助: How to pass value from controller to data store in sencha touch

handler: function() { 
    Ext.dispatch({ 
     controller: MyApp.controllers.controller, 
     action: 'myActionOnController', 
     id: e.get{'id'} 
    }); 
} 

您可以从“itemtap”,然后在控制器,你可以调用一个新的观点与你的参数调用ext.dispatch,记得使用这样的:

myActionOnController: function (options) { 
    var city = options.id; //if you want to use your parameters 
    var newView = Ext.create('MyApp.view.viewOfSomething'); 
    this.getMain().push(newView); 
},