4
votes

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
                                    });

                                }
                            }
                        }
            ]
    },
2
Any errors in the console ? Could post a bit more code (navigationview, tabbar...) - Titouan de Bailleul
No error in console.will post code - Harikrishnan
@TDeBailleul Please check my update in question. - Harikrishnan

2 Answers

5
votes

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

1
votes

I have faced this problem before. Create an initialize function in all views. Add this code in it.

this.callParent(arguments);