PDA

View Full Version : Layout/Nested Layouts Best Practices?



leathekd
2 Jan 2007, 6:50 AM
I am currently prototyping an application using yui-ext and had a question about the best way to use Layouts with a dynamic content/center area.

My app is pretty standard with north, west, and center panels. North is the title area, west is for navigation and actions, and the center is for the content. The center content can be anything from simple HTML to a Nested Layout.

I noticed that the Documentation Center uses an iframe for the content panel and was wondering- is this the recommended approach for a dynamic center area? Are there other methods that I should consider?

Thanks,
David

jack.slocum
2 Jan 2007, 7:03 AM
It really depends on what you are loading into the center panel. Personally my preference is to use XHR and UpdateManager, but the examples had to be stand-alone so I had to use an iframe. Also, I want to be able to link through the documentation without having to rewrite all the urls.

If all you are doing is displaying content, try UpdateManager. If you need more, you can use an iframe. If you are using tabs, each page can be either. :)

leathekd
2 Jan 2007, 10:26 AM
So, if the center panel is a ContentPanel and the user navigates to a page where the center area needs to be another layout with a few panels of it's own, do I...

Fetch the HTML w/ XHR, update the content of the center div to the HTML, initialize the inner layout, remove the center ContentPanel from the outer layout, add a NestedLayoutPanel, add the inner layout, and finally call outerlayout.layout()

Or can I just create the inner layout inside the current center ContentPanel?

I haven't delved into the NestedLayoutPanel code just yet, so I don't know what is special about it. I just want to make sure that I'm doing something in the intended manner and not simply code around my misunderstanding... :wink: