I have a Home.js view with some embedded xtype's for subpages in a bottom bar. First I added the other Views in the config and all was fine, but now I need to set some other stuff (i.e. username) using the initalize method.
But, now the navigation to the other views doesn't fire anymore. Nothing happens, no action is fired or any error. The view is still shown correctly.
The View
Ext.define('MyApp.view.Home', {
extend : 'Ext.tab.Panel',
id : 'home',
xtype : 'homeview',
requires : ['Ext.TitleBar', 'Ext.Video', 'MyApp.view.Profile'],
initialize : function() {
console.log('Initializing Home');
var me = this
var config = me.getInitialConfig();
var username = config.username;
var items = [];
items.push({
xtype : 'titlebar',
docked : 'top',
title : 'Hello ' + username
}, {
xtype : 'updatesview',
}, {
xtype : 'searchview',
}, {
xtype : 'profileview'
}, {
xtype : 'messagesview'
}, {
xtype : 'sensesview'
});
me.setItems(items);
console.log('Initializing Home');
},
config : {
title : 'Home',
iconCls : 'home',
tabBarPosition : 'bottom'
}
});
Switching back to this works (????)
The old view, using only config
Ext.define('MyApp.view.Home', {
extend : 'Ext.tab.Panel',
id : 'home',
xtype : 'homeview',
requires : ['Ext.TitleBar', 'Ext.Video', 'MyApp.view.Profile'],
config : {
title : 'Home',
iconCls : 'home',
tabBarPosition : 'bottom',
items : [{
xtype : 'updatesview',
}, {
xtype : 'searchview',
}, {
xtype : 'profileview'
}, {
xtype : 'messagesview'
}, {
xtype : 'sensesview'
}]
}
});
Update
I tried both
me.setItems(items);
me.addItems(items);
None work.
Update 2
OK the problem lies with the initialize function. ANY init disables the navigation (??)
initialize : function() {
console.log('init home');
},
Thanks for your help!
I think you need to call the parent init method in your init:
...
initialize : function() {
this.callParent(arguments);
...
// Rest of your code...
},
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With