views:

699

answers:

1

I am starting using YUI's Container control in my application to display messagebox popups and other dialogs.

I am not clear what the recommended/cleanest way to create a popup sourced from an external HTML file would be. I'm talking about a popup showing 'further information' about a product - which would contain text and images.

The closest example to what i want to do is the 'create a model loading dialog'. This shows a please wait graphic while it asynchronously loads external data, but on completion that data is shown in the body of the page and not inside a popup.

Now I know I could use this example for how to show a 'please wait' dialog, and on completion just show another popup with the returned data.

However I was hoping there was built in functionality to load an external file into a popup because:

a) it would be less code and event handling for me to do

b) the popup will contain images and I want the please wait to remain on screen until all images inside it have loaded. it would be a lot trickier to do that by myself

+1  A: 

Simon,

YUI Containers (Panels, Dialogs, SimpleDialogs) don't have a facility for loading external data.

You could use the workflow you describe (put the data in a new panel) or, once you've gotten the external/XHR data via Connection Manager (http://developer.yahoo.com/yui/connection/), insert it into the body of your existing "Please Wait" panel and then resize/recenter it. The latter would be more efficient, as you suggest, because you wouldn't have to create the second panel.

Use the setBody method to add your new content to the body of your Panel (http://developer.yahoo.com/yui/docs/YAHOO.widget.Module.html#method_setBody ).

-Eric

Eric Miraglia
thanks a lot! i really just wanted to verify I hadn't missed any built in functionality to do this. you guys just have too many examples! oh and I was actually watching this earlier http://video.yahoo.com/watch/3711767/10207432 so i know who you are! maybe YUI 3 will have this functionality ;-)
Simon_Weaver