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

How do you programmatically enable/disable a Context-Menu Item?

Expand Messages
  • struggling.idiot
    Greetings: I m toying with YUI Context Menu; and can see how to disable a particular menu item: oContextMenu = new
    Message 1 of 1 , May 14, 2007
    • 0 Attachment
      Greetings:
         I'm toying with YUI Context Menu; and can see how to disable a particular menu item:


          oContextMenu = new YAHOO.widget.ContextMenu("mytreecontextmenu", {
                      trigger: "psTreeDiv",
                      lazyload: true,
                      itemdata: [
                          { text: "Show Attributes", onClick: {fn: showAttributes}},
                          { text: "Add a New Element", onclick: { fn: addNode } },
                          { text: "Rename Element", onclick: { fn: editNodeLabel } },
                          { disabled: true, text: "Copy Element & Children", onclick: { fn: copyNode } },
                          { text: "Paste Element", onclick: { fn: pasteNode } },
                          { text: "Delete Element", onclick: { fn: deleteNode } },
                          { text: "----------------------"},
                          { text: "Cancel"}
                      ]
                  }           
          ); // end ContextMenu().


      The initial environment (above) works. 

      Now, how to I toggle the 'disabled' property of a particular menu item (or any menu-item property) in my JavaScript?

      Regards,

      Ric.

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