I have thi sview laid out similar to below, but on orientation chaneg I would like to remove an item (panel) and have the page view refresh to compensate for this change.
My page is made up like:
Code:
var topPanel = new Ext.Panel({
id: 'TopPanel',
......
flex:1
});
var btmPanel = new Ext.List({
id: 'BtmPanel',
.....
flex:1
});
App.views.myFirstView = Ext.extend(Ext.Panel, {
id:'myView',
dockedItems: [{.....}],
items: [topPanel,btmPanel],
......
});
Now I have the onOrientationChange function working, so what I would like to do is that within the main view ' myView' i currently have two items items: [topPanel,btmPanel].
When it detects that its in landscape mode I would like to hide/removed the topPanel, so I only have one item within the items section eg: items: [btmPanel], then it refreshed the view to show this change.
Now I can probably hide the top view (using css etc) but then as its a split view the bottom view shows and the top is hidden, but there is a gap at the top where this view was, I want to have it so the bottom view spans the whole height of the panel now.
And then when the user goes back to portrait it places the top view back etc.
I see some thing like doLayout(); and have tried this using this.doLayout(); but nothing happens.
have have the following added to my main panel:
Code:
App.views.myFirstView = Ext.extend(Ext.Panel, {
id:'myView',
dockedItems: [{.....}],
items: [topPanel,btmPanel],
......,
monitorOrientation: true,
onOrientationChange: function(orientation, w, h){
if(Ext.Viewport.orientation == 'portrait'){
display the two views...?
} else {
remove the top view and make btm view full height....
}
}
});
But I cannot seem to find the right way within the if else statement to do this.
Any help or advise would be appreciated.
Thanks Si