PDA

View Full Version : Resize Parent Container When Child Contents Change



blackey
29 Mar 2012, 2:19 PM
Hello Everyone,

First time posting hoping I could get a little help wrapping my brain around why my layout isn't working as I would expect.

Basically my layout is as follows...

Panel - layout: VBox

Carousel - layout: not-specified

Panel - id: 1 - layout: not-specified
Panel - id: 2 - layout: not-specified
Panel - id: 3 - layout: not-specified

ToolBar - layout: not-specified
ToolBar - layout: not-specified
ToolBar - layout: not-specified

My issue is after some length of time i programmatically search for id 1, then do an .appendChild() to insert an image to that component but the carousel does not resize itself to contain the new image. (tried .doComponentLayout() on the carousel after inserting the image).

If i use styling to enable borders on each of my components i see that the id 1 component doesn't encompass the image i just appended to it.

The real question is what layout should i be using for the component hierarchy listed above that will allow me to dynamically add/remove images to id 1, 2, 3 and have the parent (carousel) adjust it's height to the newly added child's size all while keeping the toolbars directly below the carousel?

Clear as mud? ;)

Any help would be appreciated!

mitchellsimoens
30 Mar 2012, 4:59 AM
The panel should be 100% of the height and width of the Carousel so if the Carousel has a height from it's parent using vbox (and using flex or height) then the panel should have that height. Now if you add an image to the panelYou should be able to see it if the parent hierarchy is setup for sizing.

blackey
30 Mar 2012, 12:55 PM
Thanks for taking a look at my issue mitchell,

For the life of me I'm not able to figure out why when i add a javascript image object to the carousel item it doesn't resize. As you can see here [http://i.imgur.com/JIm33.png] you see the blue border (top vbox carousel item) and toolbars under it. Once it add an image I'm seeing [http://i.imgur.com/a2iht.png].

I'd like to resize the top vbox item's height to that of the image (so flexing the vbox wont work).

Any specific layouts you believe i need or calls i need to make i'd be happy to try.

Thanks.

blackey
2 Apr 2012, 1:37 PM
Any ideas?

Is there documentation to setup the parent hierarchy for sizing? More specifically, autosize a parent to expand or contract depending on it's contents size.

blackey
5 Apr 2012, 1:39 PM
I fixed this by manually setting the height of the carousel once i know how tall of an image i plan on putting in there.