-
17 May 2012 7:34 PM #1
Push view to navigationview using controller in SA2
Push view to navigationview using controller in SA2
I'm trying to just push a panel view into a navigationview using a controller which is listening for a tap of a button. When i code this by hand i can use the code below in the controller and it works fine. This however does not work in architect.
----------------------------------
control: {
'home #Docs':{
tap: function(button, e, options) {
var placesView = Ext.create('FirstApp.view.CmdList');
this.getMain().push(placesView);
}
}
}
-----------------------------------
Here is the error i get "Uncaught TypeError: Cannot call method 'push' of undefined "
I am new the sencha but sencha architect is not really making the coding process easy for me here. Could someone provide a simple example? I have looked at the examples from sencha and they're not really helping me out. Thanks.
-
17 May 2012 7:42 PM #2
Do you have a controller reference called 'main' that has a selector referencing the NavigationView?
Seems like you dont.Bharat Nagwani
Sencha Designer Development Team
-
17 May 2012 8:09 PM #3
Thanks, that did help me look in the right direction. I had the reference but the alias:"main" was not set on the navigationview which is what I was using for the reference. I also change up the code a bit and it now works with the code below which is different from how it works when I didn't use sencha architect.
----------------------------
Ext.define('MyApp.controller.Home', {
extend: 'Ext.app.Controller',
config: {
refs: {
main: 'main',
home: 'home',
cmdlist: 'cmdlist'
},
control: {
"home #Docs": {
tap: 'onDocsTap'
}
}
},
onDocsTap: function(button, e, options) {
this.getMain().push({
xtype: 'cmdlist'
});
}
});
--------------------------------


Reply With Quote