2013-03-26 75 views
4

我從我的導航視圖(xtype:'mainPanel')這樣推送視圖。這是Tabbar的一個元素。在第二個視圖中,一個back按鈕顯示在導航欄中,但它不起作用。任何想法?後退按鈕不適用於sencha觸摸

itemtap: function(list, index, target, record) { 


           list.up('mainPanel').push({ 
            xtype: 'newview', 
            title: 'New', 
            data: record.data 
           }); 


} 

Main.js

Ext.define('Proj.view.Main', { 
extend: 'Ext.tab.Panel', 
xtype: 'main', 
requires: [ 
    'Ext.TitleBar','Proj.view.phone.Mainpanel','Proj.view.phone.Home','' 
], 
config: { 
    tabBar: { 
     docked: 'bottom', 
     layout: { 
      pack: 'center' 
     } 

    }, 

    items: [ 

     { 
      xtype: 'homePanel' 
     }, 
     { 
      xtype: 'mainpanel' 
     }, 

    ] 
} 

});

Mainpanel.js

Ext.define('Proj.view.phone.MainPanel', { 
    extend: 'Ext.navigation.View', 
    xtype: 'mainpanel', 
    requires : [ 
     '], 
    initialize:function(){ 

     this.getNavigationBar().add(stuff); 


Ext.getCmp('categoryList').setData(jsonObject.info); 



    }, 
    config: { 
     title : 'Shop', 
     iconCls: 'favorites', 
     styleHtmlContent: true, 
     scrollable: true, 

      items: [ 

         { 
          xtype: 'list', 
          fullscreen: true, 
          itemTpl: '{name}', 
          autoLoad: true, 
          id:'categoryList', 
          store: { 
           fields :['active', 'created','description'] 

          }, 
          listeners: { 
           itemtap: function(list, index, target, record) { 

            list.up('mainpanel').push({ 
             xtype: 'newview', 
             title: 'newview', 
             data: record.data 
            }); 

           } 
          } 
         } 
      ] 
    }, 
+0

控制檯中的任何錯誤?可以張貼更多的代碼(navigationview,tabbar ...) – 2013-03-26 13:13:46

+0

沒有錯誤console.will後代碼 – Harikrishnan 2013-03-26 13:18:12

+0

@TDeBailleul請檢查我的更新有問題。 – Harikrishnan 2013-03-27 02:43:32

回答

5

嘗試用下面的代碼重寫後退按鈕事件::

extend:'Ext.navigation.View', 
xtype:'myNavigation', 
config:{ 
    …… 
}, 
onBackButtonTap:function(){ 
    this.callParent(arguments); 
    alert('back button pressed'); 
} 

看看是否能工程。如果確實如此,那麼你會知道你正在處理返回事件錯誤,並且推送不起作用。如果它不提示警報,那麼監聽程序不工作。嘗試以編程方式使用控制器方法調用back事件,並查看是否可以改爲

+0

在Sencha 2.2.1中,你得到'this.callParent(arguments);' 的錯誤,但你可以使用'this.pop()'代替。 – Niklas 2013-07-11 23:22:12

1

我以前遇到過這個問題。在所有視圖中創建一個初始化函數。在其中添加此代碼。

this.callParent(arguments); 
+0

這將如何幫助?它有什麼作用 ? – SashaZd 2013-04-03 19:22:11

相關問題