-
22 Feb 2012 2:21 AM #1
Unanswered: New B3 NavigationView confusion
Unanswered: New B3 NavigationView confusion
I am struggling with the new navigationview behaviour that was introduced with B3, where the navigation stack and the items property of the navigationview are synced.
I used to use navigationview like a container with card layout, with setActiveItem, this worked perfectly, I had all the panels in the items property, and could push them onto the navigationview stack.
With B3 you synced the items proeprty and the stack together, which has created a problem for me.
Now one can't put all the panels that should be available to show in the items property, so these panels have to be created on-the-fly. (e.g. click on a button, create a new panel, show it). However now I cannot use the "control" property of controllers to hook into events, because the panels are created after the controller is initialized.
e.g.: I have a panel "tasklist" which hooks into the "select" event of a list it contains. I have
in my controller. But this does not work when I create the view on-the-fly, because the controller is initialized before that.Code:control : { 'todolist': { select : ... } }
I have several questions:
1. What is best-practice for hooking into events of panels that are created on the fly?
2. Is there a better way to use the "new" navigationview, than creating all panels on the fly?
3. Will the navigationview stay like this in future releases? (I would prefer if you provided 2 navigationview's, one with the old behaviour and one with the new)
Thank you very much in advance!
-
22 Feb 2012 7:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
If you have your different componentquery selectors in the control config, even if the items are created dynamically it should still listen for it. A listener in control isn't bound to any one component.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Feb 2012 5:08 AM #3
thanks for your reply, it works the way you described indeed, i seemed to have had something else wrong.
however it seems to be that there are some problems with using id's in the componentquery, but i haven't had time yet to make a test project for demonstration.
also last time i checked, using only an xtype in the componentquery, only worked with show/hide events, and using only an id in the query only worked with painted/erased events. I will test this some more and then provide test cases, but maybe you can also have a look into it.


Reply With Quote