Initialize for use later

Does anyone have any sample code that would demonstrate how one could initialize a layout inside an object that could then later be attached inside the cell of another layout.

I have cell in my main layout that I need to attach/detach other objects. When the page loads I have a simple div object attached. I have a button that will detach this object and attach a new div object. This works great, but now I’d like to detach the div and attach another layout. The sub-layout is loaded into its own div container, but when I attach this container to the cell the sub-layout does not snap the the cells dimensions like it would if the layout was created in the cell.

I’ll get together a sample of my issue, but I wanted to throw the question out there to see if anyone can give me a hint into the right direction.



you may try to use views:


one view is a div attached by attachObject method
another one - layout created by attachLayout