2012-05-21 39 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); 
},