Yahoo! UI Library

Menu  2.6.0

Yahoo! UI Library > menu > YAHOO.widget.ContextMenu

Class YAHOO.widget.ContextMenu - extends YAHOO.widget.Menu

Creates a list of options or commands which are made visible in response to an HTML element's "contextmenu" event ("mousedown" for Opera).

Constructor

YAHOO.widget.ContextMenu ( p_oElement , p_oConfig )
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the context menu.
p_oElement <String> String specifying the id attribute of the <select> element to be used as the data source for the context menu.
p_oElement <HTMLDivElement> Object specifying the <div> element of the context menu.
p_oElement <HTMLSelectElement> Object specifying the <select> element to be used as the data source for the context menu.
p_oConfig <Object> Optional. Object literal specifying the configuration for the context menu. See configuration class documentation for more details.

Properties

contextEventTarget - HTMLElement

Object reference for the HTML element that was the target of the "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of the context menu.
Default Value: null

Methods

cancel

void cancel ( )
Cancels the display of the context menu.
Returns: void

configTrigger

void configTrigger ( p_sType , p_aArgs , p_oMenu )
Event handler for when the value of the "trigger" configuration property changes.
Parameters:
p_sType <String> String representing the name of the event that was fired.
p_aArgs <Array> Array of arguments sent when the event was fired.
p_oMenu <YAHOO.widget.ContextMenu> Object representing the context menu that fired the event.
Returns: void

destroy

void destroy ( )
Removes the context menu's <div> element (and accompanying child nodes) from the document.
Returns: void

init

void init ( p_oElement , p_oConfig )
The ContextMenu class's initialization method. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the context menu.
p_oElement <String> String specifying the id attribute of the <select> element to be used as the data source for the context menu.
p_oElement <HTMLDivElement> Object specifying the <div> element of the context menu.
p_oElement <HTMLSelectElement> Object specifying the <select> element to be used as the data source for the context menu.
p_oConfig <Object> Optional. Object literal specifying the configuration for the context menu. See configuration class documentation for more details.
Returns: void

initDefaultConfig

void initDefaultConfig ( )
Initializes the class's configurable properties which can be changed using the context menu's Config object ("cfg").
Returns: void

initEvents

void initEvents ( )
Initializes the custom events for the context menu.
Returns: void

toString

String toString ( )
Returns a string representing the context menu.
Returns: String

Events

triggerContextMenuEvent

triggerContextMenuEvent ( )
Custom Event wrapper for the "contextmenu" DOM event ("mousedown" for Opera) fired by the element(s) that trigger the display of the context menu.

Configuration Attributes

trigger - String|HTMLElement|Array

The HTML element(s) whose "contextmenu" event ("mousedown" for Opera) trigger the display of the context menu. Can be a string representing the id attribute of the HTML element, an object reference for the HTML element, or an array of strings or HTML element references.
Default Value: null

Configuration attributes inherited from YAHOO.widget.Module:


Copyright © 2008 Yahoo! Inc. All rights reserved.