[CLOSED] [3.0rc1] .getLayout() return 'card' not ContainerLayout
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.
Before it's rendered, the layout will be whatever layout string you specify. Configs get assigned to the object.
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.
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.