Back button does not work on Sencha touch button

I push the view from my navigation view (xtype: 'mainPanel') like this. This is a tab item. In the second view, the back button is displayed in the navigation bar, but it does not work. 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 }); } } } ] }, 
+4
source share
2 answers

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 this works. If this is the case, then you will realize that you are not processing the back event correctly, and clicking does not work. If this does not raise a warning, the listener does not work. Try programmatically triggering a back event using the controller method and see if this works

+5
source

I have encountered this problem before. Create an initialization function in all views. Add this code to it.

 this.callParent(arguments); 
+1
source

All Articles