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

Re: Prepending to existing context menu.

Expand Messages
  • alexshusta
    Hi Stuart, Does the Menu.insertItem() method cover what you need? http://developer.yahoo.com/yui/docs/YAHOO.widget.Menu.html#insertItem
    Message 1 of 4 , May 1, 2007
    • 0 Attachment
      Hi Stuart,

      Does the Menu.insertItem() method cover what you need?

      http://developer.yahoo.com/yui/docs/YAHOO.widget.Menu.html#insertItem 

      insertItem

      YAHOO.widget.MenuItem insertItem ( p_oItem , p_nItemIndex , p_nGroupIndex )

      Inserts an item into the menu at the specified index.
      Parameters:
      p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be added to the menu.
      p_oItem <String> String specifying the text of the item to be added to the menu.
      p_oItem <Object> Object literal containing a set of menu item configuration properties.
      p_nItemIndex <Number> Number indicating the ordinal position at which the item should be added.
      p_nGroupIndex <Number> Optional. Number indicating the group to which the item belongs.
      Returns: YAHOO.widget.MenuItem


      ~Alexander

      --- In ydn-javascript@yahoogroups.com, "Stuart Grimshaw" <stuart.grimshaw@...> wrote:
      >
      > If I have a context menu that I want to change dynamically, depending
      > on the actions of users, is there any way just to splice in a new
      > bunch of options to the menu?
      >
      > I have a menu that has a bunch of default options, they are generated
      > with javascript when the page renders, then as the user browses round
      > I want to be able to replace the top section of the menu.
      >
      > I almost want to do lazy loading of the menu, but without using a
      > submenu, I want to lazy load a top level section.
      >
      > -S
      >
    • Stuart Grimshaw
      ... Spot on, thanks a lot.
      Message 2 of 4 , May 2, 2007
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "alexshusta"
        <alexander.shusta@...> wrote:
        >
        > Hi Stuart,
        >
        > Does the Menu.insertItem() method cover what you need?

        Spot on, thanks a lot.
      • Stuart Grimshaw
        ... Blimey, it s been two months since I looked at this ... When I do Menu.insertItem I get the following error: oGroupItem.element has no properties
        Message 3 of 4 , Jul 19, 2007
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "alexshusta"
          <alexander.shusta@...> wrote:
          >
          > Hi Stuart,
          >
          > Does the Menu.insertItem() method cover what you need?

          Blimey, it's been two months since I looked at this ...

          When I do Menu.insertItem I get the following error:

          oGroupItem.element has no properties
          http://beavis.vdevstuart.development.sheffield.sdl.corp/js/ceaf/yui/menu/menu.js
          Line 1461

          I'm calling it like this:

          oContextMenu.insertItem(new YAHOO.widget.MenuItem(commands[n]), 0);

          Where commands[n] is a string.
        Your message has been successfully submitted and would be delivered to recipients shortly.