Change a vbox into a hbox and vice versa on orientation change
Hi there,
I've built a horizontally scrollable hbox layout container, docked on top, filled with other sub-containers, which I want to transform into a vbox layout (scrollable vertically, docked to the left) on orientation change.
Right now I'm doing something like this on resize:
Code:
var hboxLayout = Ext.getCmp('hboxLayoutID');
Ext.getCmp('hboxLayoutParentID').removeAll(false, true);
if(Ext.Viewport.getOrientation()=='landscape'){
hboxLayout.setDocked('left');
hboxLayout.setLayout({
pack: 'center',
type: 'vbox'
});
hboxLayout.setScrollable({
direction: 'vertical'
});
hboxLayout.setHeight('auto');
hboxLayout.setWidth(100);
}else{
hboxLayout.setDocked('top');
hboxLayout.setLayout({
pack: 'center',
type: 'hbox'
});
hboxLayout.setScrollable({
direction: 'horizontal'
});
hboxLayout.setHeight(100);
hboxLayout.setWidth('');
};
Ext.getCmp('hboxLayoutParentID').add([hboxLayout]);
It kinda does what it's supposed to (it snaps to the left / top, becomes vertically / horizontally scrollable, sets the correct width / height), EXCEPT re-aligning the sub-containers properly - they either remain aligned horizontally (if the initial view was landscape) or vertically (for initial portrait view).
Am I missing something / doing something wrong?