Is there a way to programmatically resize the items (or containers/components -- please forgive my term ignorance -- either when adding a child (with addChild()) or after the fact -- e.g., set the widths of the three items to 50%, 25%, 25% each?
By the way, golden-layout is awesome. Thanks for making it.
I have the same question.. how can we set the size of an component thru code?
I'll join in... I need to have a component contain a video, and have the container grow proportionally in width and height when a resize event occurs. HD video is 16:9, so when height changes, I need to adjust the width to be height * 1.777778, and adjusting width should set the height to width * .5625. Any ideas?
Firstly, you need to get the item for each container. You can use different methods for this, such as
javascript
myLayout.root.getItemsById("itemId")
Available methods -
This returns a list of items matching the id, you can use the attribute ".parent" on these items to get the stack.
The width data is held in the stack config
myLayout.root.getItemsById("itemId")[0].parent.config.width
set this equal to your width for each stack, then just call update size to refresh the view.
myLayout.updateSize()
Most helpful comment
Firstly, you need to get the item for each container. You can use different methods for this, such as
javascript myLayout.root.getItemsById("itemId")Available methods -
This returns a list of items matching the id, you can use the attribute ".parent" on these items to get the stack.
The width data is held in the stack config
set this equal to your width for each stack, then just call update size to refresh the view.