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

Re: Toggles checked in menu items

Expand Messages
  • dean.grubb
    Ok, thanks for all that, this works; I think those extra vars confused me and the issue was with the length, oMenu.getItems().length returned the number of
    Message 1 of 7 , Aug 30, 2007
    • 0 Attachment
      Ok, thanks for all that, this works; I think those extra vars confused
      me and the issue was with the length, oMenu.getItems().length returned
      the number of menu items and of course oMenu.getItem(x) needed to loop
      from 0 to the number of items - 1;

      <script>
      YAHOO.util.Event.onContentReady("menumonths", function () {
      var oMenu = new YAHOO.widget.Menu(
      "menumonths",
      {
      position: "static",
      hidedelay: 150,
      lazyload: false
      }
      );

      function onMenuClick(p_sType, p_aArgs) {
      var oEvent = p_aArgs[0];
      oMenuItem = p_aArgs[1];

      items = oMenu.getItems().length;
      for (var x = 0; x <= items-1; x++)
      {
      oMenu.getItem(x).cfg.setProperty("checked", false);
      }

      oMenuItem.cfg.setProperty("checked", true);

      }

      oMenu.render();
      oMenu.subscribe("click", onMenuClick);

      });
      </script>




      --- In ydn-javascript@yahoogroups.com, "badotzo" <of_interest@...> wrote:
      >
      > Not only that, but you use DIFFERENT VARIABLE NAMES:
      >
      > var aItems = oMenu.getItems();
      > for (var x = 0; x <= aItems.length; x++)
      > {
      > oMenu.getItem(x).cfg.setProperty("checked", false);
      > }
      >
      > oMenu.getItems()
      >
      > AND
      >
      > oMenu.getItem(x)
      >
      > Methinks that is also part of your confusion?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.