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

Re: On select event for YAHOO.widget.button type menu?

Expand Messages
  • mathew.rowley
    I am really confused... the API doc for YAHOO.widget.Menu says that there is an event: clickEvent clickEvent ( ) Fires when the user clicks the on the menu.
    Message 1 of 3 , Mar 2, 2008
      I am really confused... the API doc for YAHOO.widget.Menu says that
      there is an event:

      clickEvent
      clickEvent ( )
      Fires when the user clicks the on the menu. Passes back the DOM Event
      object as an argument.

      But, if I do the following:
      var selectTable = new YAHOO.widget.Button("selectTable", {
      type: "menu",
      label: "<div>" + ListMgmt.tableId + "</div>",
      menu: "selectTableSelect"
      });
      var selectTableMenu = selectTable.getMenu();
      selectTableMenu.subscribe("clickEvent", function(o){alert(o);});


      When I click the menu, there is no alert...

      Am I doing something wrong?




      --- In ydn-javascript@yahoogroups.com, "mathew.rowley"
      <mathew.rowley@...> wrote:
      >
      > How do you handle when a user selects a menu item of a
      > YAHOO.widget.button with a type of 'menu'?
      >
      > For exmaple, I want to reload a datatable when a user selects a menu
      > item of the YAHOO.widget.button - the selected menu item defines the
      > id of the datatable to load.
      >
      > Thanks in advance.
      >
    • Jing Ceawlin
      Hi mathew, You have to use selectTableMenu.subscribe( click , function(o){alert(o);}) here. I know this is kinda strange, and I didn t know why either. After
      Message 2 of 3 , Mar 3, 2008
        Hi mathew,
        You have to use selectTableMenu.subscribe("click", function(o){alert(o);}) here. I know this is kinda strange, and I didn't know why either. After looking at the source code, I found that Menu's subscribe function is defined right in the Menu class, not the one YAHOO.util.EventProvider has. This is not a bug, but obviously inconsistent.
        Hope this helps :)

        Regards,
        Jing

        On Mon, Mar 3, 2008 at 2:01 PM, mathew.rowley <mathew.rowley@...> wrote:

        I am really confused... the API doc for YAHOO.widget.Menu says that
        there is an event:

        clickEvent
        clickEvent ( )
        Fires when the user clicks the on the menu. Passes back the DOM Event
        object as an argument.

        But, if I do the following:
        var selectTable = new YAHOO.widget.Button("selectTable", {
        type: "menu",
        label: "<div>" + ListMgmt.tableId + "</div>",
        menu: "selectTableSelect"
        });
        var selectTableMenu = selectTable.getMenu();
        selectTableMenu.subscribe("clickEvent", function(o){alert(o);});

        When I click the menu, there is no alert...

        Am I doing something wrong?

        --- In ydn-javascript@yahoogroups.com, "mathew.rowley"


        <mathew.rowley@...> wrote:
        >
        > How do you handle when a user selects a menu item of a
        > YAHOO.widget.button with a type of 'menu'?
        >
        > For exmaple, I want to reload a datatable when a user selects a menu
        > item of the YAHOO.widget.button - the selected menu item defines the
        > id of the datatable to load.
        >
        > Thanks in advance.
        >


      Your message has been successfully submitted and would be delivered to recipients shortly.