Hybrid View
-
1 Nov 2012 7:19 AM #1
Answered: Calling same view
Answered: Calling same view
Hello all,
I have an app that is moving different screens (login, 1st screen and a second screen with different views each)
I have addressed the problem with a NavigationView
now the first screen (navigation view) is calling two items/view:
- login
- info (having data loaded from store) (1)
Code:Ext.define("MyApp.view.access1.Main", { extend: 'Ext.tab.Panel', xtype: 'Main', requires: [ 'Ext.TitleBar' ], config: { tabBarPosition: 'bottom', items: [ { xtype: 'Login' }, { xtype: 'Info' } ] } });
after login the second screen is called; here we have again two items
- interests
- info (2)
Code:Ext.define("MyApp.view.access2.MainG", { extend: 'Ext.tab.Panel', xtype: 'MainG', requires: [ 'Ext.TitleBar', 'MyApp.view.access2.Gateway', ], config: { tabBarPosition: 'bottom', items: [ { xtype: 'Gateway' }, { xtype: 'Info' } ] } });
now the problem is: info second screen is blank, no way I can address it with controller. Only way to solve is to comment info in the first screen (1)
I have tried also to call with
before Pushing MainG => with no successCode:Ext.destroy("infoview"); Ext.destroy("MyApp.view.info");
Code:Ext.destroy("infoview"); Ext.destroy("SmartConferenceP.view.info"); this.getAccess1().push({ xtype: 'MainG' });
Can you please help me in solving this issue; I'm probably doing something wrong in the logic of the things calling again a View that is already been created (of course "Info" is also declared in app.js file)
I can provide more code if required
thank you very much in advance
Alex
-
Best Answer Posted by haduki
REMOVE your id config in your view definition.
Your view is not singleton,if you really need id ,config it when you create it.
Code:Ext.define("MyApp.view.access1.Main", { extend: 'Ext.tab.Panel', xtype: 'Main', requires: [ 'Ext.TitleBar' ], config: { tabBarPosition: 'bottom', items: [ { xtype: 'Login' }, { xtype: 'Info', id:'infoview1' } ] } }); Ext.define("MyApp.view.access2.MainG", { extend: 'Ext.tab.Panel', xtype: 'MainG', requires: ['Ext.TitleBar', 'MyApp.view.access2.Gateway' ], config: { tabBarPosition: 'bottom', items: [{ xtype: 'Gateway' }, { xtype: 'Info', id: 'infoview2' }] } });
-
1 Nov 2012 7:54 AM #2
Did you assign the 'id' config to your infoview?
SmartConferenceP.view.info and MyApp.view.info are different class, did you define them with same xtype?I write English by translator.
-
2 Nov 2012 11:32 AM #3
that was indeed a mistyping from previous version
I have reduced the code to restrict the problem
the code inserted is the one you were mentioning:
to complete the information I had also to remove the id from my View class, the screen was in fact totally blank in that case (I gave myself the answer cause they were two classes with the same id)Code:Ext.destroy("infoview"); Ext.destroy("MyApp.view.info"); this.getAccess1().push({ xtype: 'MainG' });
but then the question remains:
calling again the same view declared; how to manage it ?
the solution of defining different views (2) for each "screen" of the App does not seem an elegant solution to me
thank you again for any help
Alessandro
-
2 Nov 2012 11:42 AM #4
I give an answer myself with:
- reintroducing the id in the Info View class
- and with the code Ext.getCmp("infoview").destroy();
now the only problem is when i pop() back to the previous view the Info Panel is not showing nor the button on the bottom bar
very strange but I feel quite close to the solution ....
-
3 Nov 2012 8:23 AM #5
no; is not working in this way
anyone has additional suggestions on how to pushing a new view that has the same xtype from the previous one ?
-
3 Nov 2012 10:45 PM #6
why you reintroducing the id again? you had got the answer:remove the id config .
if your view is not singleton,do not specify the id.
use Ext.ComponentQuery.query ,container.getComponent (need itemId config),container.down to manage the new view.I write English by translator.


Reply With Quote