2011-08-29 54 views
0

我试图让我的测试项目工作,并让它为每个屏幕设置了各种视口js文件。我现在已经设法将数据加载到屏幕上,下面的代码,但我努力尝试设置onItemDisclosure函数,以便它切换到一个详细的视图,显示更多关于选择项目的信息。SenchTouch onItemDisclosure加载详细视图问题

MobileApp.views.Settings_screen = Ext.extend(Ext.Panel, { 

    title: "Settings ", 
    iconCls: "settings", 
    fullscreen: true, 
    layout: 'card', 

    dockedItems: [{ 
     xtype: "toolbar", 
     title: "Settings" 
    }], 

    initComponent: function() { 

     detailPanel = new Ext.Panel({ 
      id: 'detailPanel', 
      tpl: 'Hello, World' 
     }), 


     this.list = new Ext.List({ 
      id: 'indexlist', 
      store: MobileApp.listStore, 
      itemTpl: '<div class="contact">{firstName} {lastName}</div>', 
      grouped: false, 
      onItemDisclosure: function() { 
       MobileApp.views.setActiveItem('detailPanel'); 
      } 
     }); 

     this.items = [this.list]; 

     MobileApp.views.Settings_screen.superclass.initComponent.apply(this, arguments); 

    } 

}); 

Ext.reg('settings_screen', MobileApp.views.Settings_screen); 

我试图把这里的一些代码切换到detailPanel,但它出现了一个未定义的错误。

onItemDisclosure: function() { 
    MobileApp.views.setActiveItem('detailPanel'); 
} 

感谢阿龙

回答

0

你需要下Settings_screen的命名空间来定义这个面板中,像这样:

this.detailPanel = new Ext.Panel({ 
     id: 'detailPanel', 
     tpl: 'Hello, World' 
    }), 

此外,您还需要将detailPanel添加到Settings_screen的项目,所以它会成为它的一个项目。

this.items = [this.list, this.detailPanel]; 
+0

嗨感谢我仍然在努力试图得到这个工作,并尝试我也不太清楚,我把this.detailPanel =新Ext.Panel代码的回答吗? – MonkeyBlue

+0

并不多。在你定义了详细面板的initComponent后面,detailPanel = new Ext.List ...使用this.detailPanel进行更改,并在其中添加项目this.items = [this.list],使用this.items = [this .list,this.detailPanel] – keune

+0

嗨,谢谢你,我现在已经改变了代码,但现在当我点击这一行上的信息时,出现错误MobileApp.views.setActiveItem('this.detailPanel');未定义不是一个函数 – MonkeyBlue