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

10162Re: [ydn-javascript] can you unsubscribe clickEvents on individual menu items?

Expand Messages
  • Todd Kloots
    Mar 1, 2007
      No, at least not in the way that you demonstrated in your example. You are adding a "clickEvent" listener to a menu, not individual items. Therefore, there is nothing to unsubscribe from at the menu item level. That said, you CAN subscribe to the "clickEvent" of each item in your menu and then remove those via "unsubscribe" as necessary. For example:

      var oMenu = new YAHOO.widget.Menu("mymenu");

      { text: "Item One", onclick: { fn:onMenuItemClick } },
      { text: "Item Two", onclick: { fn:onMenuItemClick, obj:"foo" } },
      { text: "Item Three", onclick: { fn:onMenuItemClick, obj: ["foo", "bar"] } },

      oMenu.clickEvent.subscribe(onMenuClick, oMenu, true);


      - Todd

      ----- Original Message ----
      From: iamakimmer <iamakimmer@...>
      To: ydn-javascript@yahoogroups.com
      Sent: Thursday, March 1, 2007 3:39:05 PM
      Subject: [ydn-javascript] can you unsubscribe clickEvents on individual menu items?


      I'm very new to YUI...and I was wondering, if you have a menu and you
      subscribe the menu to a function like this:
      oMenu.clickEvent.subscribe(onMenuClick, oMenu, true);

      can you unsubscribe individual menu items? I was thinking something like:

      Is this possible?


      Yahoo! Groups Links
    • Show all 2 messages in this topic