1. #1
    Sencha User
    Join Date
    Nov 2007
    Posts
    294
    Vote Rating
    0
    Sesshomurai is on a distinguished road

      0  

    Default [CLOSED] [3.0rc1] .getLayout() return 'card' not ContainerLayout

    [CLOSED] [3.0rc1] .getLayout() return 'card' not ContainerLayout


    Hi,
    I have a Panel with layout:'card'. When I call panel.getLayout() it returns only the string 'card' and not the ContainerLayout object. Is this a bug? I need to get the layout instance to setActiveItem, but not sure if there is another way.

    Thanks for any tips.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Before it's rendered, the layout will be whatever layout string you specify. Configs get assigned to the object.

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Sesshomurai -

    What is occurring is that you are accessing the layout configuration before it is turned into a layout manager. Take a look at the Ext 2.0 Overview which also applies to Ext 3 and the component life cycle. Where are you accessing getLayout()? Try it later in the component life cycle and you will find that the layout is now an instance of a CardLayout Manager.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  4. #4
    Sencha User
    Join Date
    Nov 2007
    Posts
    294
    Vote Rating
    0
    Sesshomurai is on a distinguished road

      0  

    Default


    Hey guys,
    My call to panel.getLayout() was after the panel was instantiated. That's why I was expecting ContainerLayout to be returned by getLayout(). But the panel _may_ not have been rendered yet.

    But I will re-structure it properly. As a workaround, I just created an instance of CardLayout (hehe, I know the docs prefer not to) during creation, but it allowed my code to be better encapsulated in some places.

    Gratzie!

Thread Participants: 2