1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    1
    Tobias2200 is on a distinguished road

      0  

    Default 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
    Code:
    control : {
       'todolist':
           {
                select : ...
            }
    }
    in my controller. But this does not work when I create the view on-the-fly, because the controller is initialized before that.
    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!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Answers
    3521
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    1
    Tobias2200 is on a distinguished road

      0  

    Default


    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.

Thread Participants: 1