PDA

View Full Version : Viewport problems.. how to load a window in the center region in viewport



farout
3 Nov 2010, 11:39 AM
hi...
how can i load my window to my center region in viewport

and my second problem is when clicking on the Visitor List button loads or show the form and clicking the Visitor List button a second time makes the form disappear. Any reason it would not reload itself?

My viewport


var viewport = new Ext.Viewport({
layout: 'border',
renderTo: Ext.getBody(),
items: [{
region: 'north',
xtype: 'panel'
,title: 'TEST'
,tbar:[{
xtype: 'tbspacer'
},{
xtype: 'tbbutton',
text: 'Visitor List',
handler: function(btn){
winvisitorlist.show();
}
}
]
},{
region: 'center',
xtype: 'panel'
}
,{
region: 'west'
,xtype: 'panel'
,width: 200
,title: 'Message'
,split: true
,collapsible:true
}]
});



my window


var winaddvisitor = new Ext.Window({
title: 'Visitor List',
id: 'helpwin',
width: 300,
height: 300,
modal: true,
tbar: [{
text: 'Add Visitor',
handler: function(){
winaddvisitor.show();
}
},{
text: 'Disable',
handler: function(t){
t.disable();
}
}
]
});



thanks

Condor
4 Nov 2010, 12:43 AM
Your visitor list shouldn't be a window at all.
- Change visitorlist to be a panel.
- Make your center region layout:'fit' (or 'card').
- add() visitorlist to the center region and call doLayout.