PDA

View Full Version : struggling with replacing viewport elements



bareflix
17 May 2010, 6:07 PM
I have created a viewport that has an east panel defined as:


vp_east = new Ext.Panel(
{
region: 'east',
title: 'Actions',
width: 200,
hidden: false,
collapsible: true,
margins: '0 5 0 10',
layout: {
type:'vbox',
padding:'5',
align:'stretch'
}
});

when the user presses a button, I want to insert the following:


var buttons = new Ext.Container(
{
layout: {
type:'vbox',
padding:'5',
align:'stretch'
},

defaults:
{
margins:'0 0 5 0',
cls: 'main-button'
},
items: [
{
xtype: 'button',
text: 'Characters',
handler: clicked
},
]});

vp_east.add (buttons);

This works, but I can only see the buttons if I hard code a height and width for them. What do I have to set or call on the parent to make buttons fill up all the space in the parent?

--
Chris

jay@moduscreate.com
17 May 2010, 6:23 PM
add vp_east.doLayout() after vp_east.add()

bareflix
17 May 2010, 7:00 PM
I do have vp_east.doLayout ();
I even have vp.doLayout();

sorry I left them out of the example.

If I hard code the height of buttons, they show up.

Is there a layout tutorial that I'm missing? I think I understand how it works, but when I try things they don't do what I expect, or I can't find an option I expect to have. Like "fill" in this case.