Loading ...
Sorry, an error occurred while loading the content.

Re: YUI Loader Problems w/ dynamic MenuItems

Expand Messages
  • Levi
    Well, I have found that if in my onSuccess handler that actually calls the Menu.render(document.body), if I wrap that in a setTimeout like this:
    Message 1 of 2 , Aug 25, 2008
    • 0 Attachment
      Well, I have found that if in my onSuccess handler that actually calls
      the Menu.render(document.body), if I wrap that in a setTimeout like this:

      setTimeout(function(){
      self.myMenu.render(document.body);
      },0);

      Everything works alright in IE. Why would allowing the stack to clear
      make a difference in this _only_ when the script has been injected via
      the YUI Loader? Any help would be greatly appreciated, and please let
      me know if I can provide any further information.

      Thanks,

      Levi


      --- In ydn-javascript@yahoogroups.com, "Levi" <skankwilsonite@...> wrote:
      >
      > I modified a page to use the YUI loader to dynamically bring in the
      > only the files that I need. The base URL is a local server on the
      > network. I have a JavaScript class that builds itself in a <div />
      > once the page has been loaded. That class contains a YUI menu button,
      > and the menu is built after an asynchronous call to a web service.
      > The problem I have is that in IE, even though I call the menu's
      > render() method after I dynamically build the menu item's, it is not
      > properly rendered. If I explicitly call the render method again after
      > I can see the page, everything is fine. This problem seemed to only
      > occur after I changed my page to use the YUI Loader. If there is any
      > other information that I need to provide, please let me know. Thanks
      > in advance for any help!
      >
      > // pseudo-code showing how I instantiate my class that builds itself
      > // in a <div /> in my page.
      > var loader = new YAHOO.util.YUILoader(
      > {require: ['myclass'],
      > base: 'http://myurl/yui/build',
      > onSuccess: function() {
      > Event.onDOMReady(function() { var myClass = new MyClass('my-id'); }
      > }});
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.