2011-06-09 56 views
1

我正在與Sencha觸摸框架和列表項組件。我現在只用了大約2周的時間,我無法弄清楚如何讓「onItemDisclosure」打開「detailPanel」。我試圖按照這個例子:http://vimeo.com/19245335。下面粘貼了我的代碼。很感謝任何形式的幫助。Sencha觸摸列表組件內的選項卡式工具欄

GoW3Guide.views.detailPanel = Ext.extend(Ext.Panel, { 
     id: 'detailpanel', 
     tpl: 'Hello, {firstName}!', 
     dockedItems: [ 
      { 
       xtype: 'toolbar', 
       items: [{ 
        text: 'back', 
        ui: 'back', 
        handler: function() { 
         GoW3Guide.Viewport.setActiveItem('disclosurelist', {type:'slide', direction:'right'}); 
        } 
       }] 
      } 
     ] 
    }); 

    Ext.reg('detailPanel', GoW3Guide.views.detailPanel); 


    GoW3Guide.views.listPanel = Ext.extend(Ext.List, { 
     id: 'disclosurelist', 
     store: GoW3Guide.ListStore, 
     itemTpl: '<div class="contact">{firstName} {lastName}</div>', 
     grouped: true, 
     onItemDisclosure: function(record, btn, index) { 
      GoW3Guide.views.detailPanel.update(record.data); 
      GoW3Guide.views.Guidescard.setActiveItem('detailpanel'); 
     } 
    }); 

    Ext.reg('listPanel', GoW3Guide.views.listPanel); 



    GoW3Guide.views.Guidescard = Ext.extend(Ext.Panel, { 
     fullscreen: true, 
     layout: 'card', 
     cardSwitchAnimation: 'slide', 
     initComponent: function() { 
      Ext.apply(this, { 
       items: [GoW3Guide.views.listPanel, GoW3Guide.views.detailPanel] 
      }); 
      GoW3Guide.views.Guidescard.superclass.initComponent.apply(this, arguments); 
     } 
    }); 
    Ext.reg('guidescard', GoW3Guide.views.Guidescard); 

回答

0

您是否收到任何javascript錯誤?

根據文檔setActiveItem需要一個組件實例,一個數字(卡片索引)或一個配置對象,例如, {的xtype: 'detailPanel'}

如果你想創建一個新的細節面板積極嘗試

GoW3Guide.views.Guidescard.setActiveItem({xtype:'detailpanel'}); 

GoW3Guide.views.Guidescard.setActiveItem(new GoW3Guide.views.detailPanel());