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

Issue Re-rendering menus

Expand Messages
  • clementsian
    I have a Menu which is built up entirly from javascript calls to web services. Everything works fine, its very similar to Erics Dynamic rendering menu
    Message 1 of 1 , Jan 31, 2007
    • 0 Attachment
      I have a Menu which is built up entirly from javascript calls to web
      services. Everything works fine, its very similar to Erics Dynamic
      rendering menu example. Once a MenuItem has been chosen the menu
      dissapears and thats it. The problem starts when I show the menu
      again. Because the content which makes up the menu items and sub
      menus is very dynamic the web services need to be called again to
      rebuild the menu structure.

      I have a rootMenu object which actually stores the top level menu
      object. I call a clearMenu function which is listed below - why
      yahoo dont provide one is a bit of a mystery. I then add menu items
      back into it from the web service and call a render for the menu.

      _clearMenu : function(menu){
      var menuItem;
      do{
      menuItem=menu.removeItem(0);
      }
      while(menuItem)
      }

      However this time round I get an exception "NS_ERROR_INVALID_POINTER"
      on the function - appendTo(appendToNode); when it tries to render.

      Basicaly I think it has something to do with the fact that I have
      previously called a render for the menu and some of the items had
      event listners subscribed.

      I realise this example is not very clear. Unfortunalty I am
      incorporating the menu into an ASP.NET AJAX Control so I can't really
      send any meaningfull example code.

      If someone can just tell me the pattern for clearing out a Menu object
      of all its menu items and submenus and then adding in new ones and
      rendering them that would be great.
    Your message has been successfully submitted and would be delivered to recipients shortly.