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

Having Problems With Menu Button on Toolbar

Expand Messages
  • mainerefugee
    Hi All, I am currently making an AJAX call and using the JSON result to build a special menu button on the toolbar. My problem is that none of the events are
    Message 1 of 1 , Aug 22, 2008
    • 0 Attachment
      Hi All,

      I am currently making an AJAX call and using the JSON result to build
      a special menu button on the toolbar. My problem is that none of the
      events are firing for Menu or Menu items. Here is the code:

      //------------------------------------------------------------
      //
      //------------------------------------------------------------

      ns.Actionbar.prototype.handleStateChange = function(e, object) {

      var button = this.getButtonById("statusMenu");


      var menuItems = new Array();

      for (var x=0; x < object[0].availableStates.length; x++) {
      var item = new Object();
      item.text = object[0].availableStates[x].name;
      item.value = object[0].availableStates[x].id;
      if (object[0].availableStates[x].name == object[0].currentState) {
      item.checked = true;
      }

      //item.onclick = {fn:this.dummy,obj:null,scope:this};
      var menuItem = new YAHOO.widget.MenuItem(item);
      menuItems.push(item);
      }

      //var menu = new YAHOO.widget.Menu(menuItems);



      if (button) {

      }

      else {

      if (!this.groupConfigs["status"]) {

      this.groupConfigs["status"] = { group: 'states', label: 'Status',
      buttons: [
      {id:"menuStates", type: 'select', label: object[0].currentState,
      value: 'state', "menu": menuItems}
      ]
      };

      this.addButtonGroup(this.groupConfigs["status"]);

      }

      }


      var oMenu = this.getButtonById("menuStates").getMenu();
      oMenu.subscribe("change",function(){alert("this is a test");});
      return;

      };


      The button is created and I can interact with it but no events seem to
      be firing. I have included all the -debug.js files and I am using
      the YUI logger. The only events that are firing are
      Toolbar.buttonClick and some object call Config (which I can't seem to
      add listeners to).


      Thanks for the help.
    Your message has been successfully submitted and would be delivered to recipients shortly.