-
22 Jan 2013 5:20 PM #1
Answered: Adding item to a navigation view gives 'undefined method'
Answered: Adding item to a navigation view gives 'undefined method'
Hi guys,
I've got a class which extends Ext.tab.Panel and a class which extends Ext.navigation.View nested within it.
In my controller, I would like to add another Ext.navigation.View to the Ext.navigation.View which is already part of the tab panel so that when the tab panel is pushed to the main view, both views appear (nested within one another).
In my controller, I've got refs:
and I've got the code in a function which is attached to an event that is caught. How can I add navview2 to navview1, in order to get the same effect as if navview2 appears in navview1's items[] array?Code://Views tabpanel: 'tabpanel', navview1: 'navview1', navview2: 'navview2',
I've tried a number of permutations of the 'add' method, but keep getting 'undefined method' or similar, but the 'add' method clearly appears in the documentation under Ext.navigation.view, and the example provided has not been helpful. What am I doing wrong?
Thanks!
-
Best Answer Posted by JohnM_
OK, I've got it. I was getting hung up on refs and xtypes, making it harder than it should have been. Here's the answer that I found.
This works in the controller (screen, screen2, and screen3 are defined in their own files, and mainview is a ref to the 'main' view of my program):
Code:var screen = Ext.create('TestProgram.view.Screen'); var screen2 = Ext.create('TestProgram.view.Screen2'); var screen3 = Ext.create('TestProgram.view.Screen3'); screen2.add(screen3); screen.add(screen2); this.getMainview().push(screen);
-
22 Jan 2013 5:37 PM #2
OK, I've got it. I was getting hung up on refs and xtypes, making it harder than it should have been. Here's the answer that I found.
This works in the controller (screen, screen2, and screen3 are defined in their own files, and mainview is a ref to the 'main' view of my program):
Code:var screen = Ext.create('TestProgram.view.Screen'); var screen2 = Ext.create('TestProgram.view.Screen2'); var screen3 = Ext.create('TestProgram.view.Screen3'); screen2.add(screen3); screen.add(screen2); this.getMainview().push(screen);


Reply With Quote