back button not working on sencha touch

navigation, push, sencha-touch, sencha-touch-2

Solution

Try overriding the back button event with the following code ::

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

See if that works. If it does, then you'll know you're handling the back event wrong, and the push isn't working. If it doesn't throw up the alert, then the listener isn't working. Try to programmatically call the back event using a controller method, and see if that works instead

Problem

I'm pushing a view from my navigation view (xtype : 'mainPanel') like this. It's an element of tabbar. In the 2nd view a `back` button is displayed in navigation bar,But it's not working. Any idea? ``` 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 }); } } } ] }, ```

Original source