Login Register Help
API Documentation
Choose a stylesheet:

Constructordijit.MenuItem

dojo.require("dijit.Menu");
defined in dijit/Menu.js

Usage

var foo=new dijit.MenuItem(params: Object?, srcNodeRef: DomNode|String);
parametertypedescription
paramsObjectOptional.
srcNodeRefDomNode|String 

Jump to PropertiesFunctionsBack to top

Functionattr(name: String|Object, value: Object?)
Defined by dijit._Widget
Set or get properties on a widget instance.
Construct the UI for this widget from a template, setting this.domNode.
Functionconnect(obj: Object|null, event: String|Function, method: String|Function)
Defined by dijit._Widget
Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.
Functioncreate(params: Object?, srcNodeRef: DomNode|String?)
Defined by dijit._Widget
Kick off the life-cycle of a widget
Functiondestroy(preserveDom: Boolean)
Defined by dijit._Widget
Destroy this widget, but not its descendants. Will, however, destroy internal widgets such as those used within a template.
FunctiondestroyDescendants(preserveDom: Boolean?)
Defined by dijit._Widget
Recursively destroy the children of this widget and their descendants.
FunctiondestroyRecursive(preserveDom: Boolean?)
Defined by dijit._Widget
Destroy this widget and it's descendants. This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it's removed from the manager object.
FunctiondestroyRendering(preserveDom: Boolean?)
Defined by dijit._Widget
Destroys the DOM nodes associated with this widget
Functiondisconnect(handles: Object)
Defined by dijit._Widget
Disconnects handle created by this.connect. Also removes handle from this widget's list of connects
Defined by dijit._Widget
Returns all the widgets that contained by this, i.e., all widgets underneath this.containerNode.
Defined by dijit._Contained
Returns the index of this widget within its container parent. It returns -1 if the parent does not exist, or if the parent is not a dijit._Container
Defined by dijit._Contained
Returns null if this is the last child of the parent, otherwise returns the next element sibling to the "right".
Defined by dijit._Contained
Returns the parent widget of this widget, assuming the parent implements dijit._Container
Defined by dijit._Contained
Returns null if this is the first child of the parent, otherwise returns the next element sibling to the "left".
Defined by dijit._Widget
Return true if this widget can currently be focused and false if not
Defined by dijit._Widget
Checks the page for text direction
Defined by dijit._Widget
stub function. Override or connect to this method to receive notifications for when the widget moves out of focus.
FunctiononClick(evt: Event)
Overrides dijit._Widget
User defined function to handle clicks
Defined by dijit._Widget
Callback if someone tries to close the child, child will be closed if func returns true
FunctiononDblClick(event: mouse)
Defined by dijit._Widget
Connect to this function to receive notifications of mouse double click events.
Defined by dijit._Widget
stub function. Override or connect to this method to receive notifications for when the widget moves into focus.
FunctiononKeyDown(event: key)
Defined by dijit._Widget
Connect to this function to receive notifications of keys being pressed down.
FunctiononKeyPress(event: key)
Defined by dijit._Widget
Connect to this function to receive notifications of printable keys being typed.
FunctiononKeyUp(event: key)
Defined by dijit._Widget
Connect to this function to receive notifications of keys being released.
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse button is pressed down.
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse moves onto this widget.
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse moves off of this widget.
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
FunctiononMouseOut(event: mouse)
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
FunctiononMouseUp(event: mouse)
Defined by dijit._Widget
Connect to this function to receive notifications of when the mouse button is released.
FunctionplaceAt(reference: String|DomNode|_Widget, position: String?|Integer?)
Defined by dijit._Widget
Place this widget's domNode reference somewhere in the DOM based on standard dojo.place conventions, or passing a Widget reference that contains and addChild member.
Overrides dijit._Widget
Called after a widget's dom has been setup
Defined by dijit._Widget
Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.
Functionpostscript(params: Object?, srcNodeRef: DomNode|String)
Defined by dijit._Widget
kicks off widget instantiation, see create() for details.
FunctionsetAttribute(attr: String, value: anything)
Defined by dijit._Widget
FunctionsetDisabled(disabled: Boolean)
FunctionsetLabel(content: String)
Defined by dijit._Widget
Called after a widget's children, and other widgets on the page, have been created. Provides an opportunity to manipulate any children before they are displayed. This is useful for composite widgets that need to control or layout sub-widgets. Many layout widgets can use this as a wiring phase.
Defined by dijit._Widget
returns a string that represents the widget. When a widget is cast to a string, this method will be used to generate the output. Currently, it does not implement any sort of reversable serialization.
Defined by dijit._Widget
stub function. Override to implement custom widget tear-down behavior.
Defined by dijit._Widget
Step during widget creation to copy all widget attributes to the DOM as per attributeMap and _setXXXAttr functions.
Defined by dijit._Templated
Iterate through the template and attach functions and nodes accordingly.
Function_attrToDom(attr: String, value: String)
Defined by dijit._Widget
Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified in attributeMap.
Defined by dijit._Templated
relocate source contents to templated container node this.containerNode must be able to receive children, or exceptions will be thrown
Defined by dijit._Widget
helper function for Widget.attr() cache attribute name values so we don't do the string ops every time
Function_getSibling(which)
Defined by dijit._Contained
Defined by dijit._Widget
Function_onClick(evt)
Defined by dijit._Widget
Called when someone connects to one of my handlers. "Turn on" that handler if it isn't active yet.
Defined by dijit._Widget
callback when mouse is moved onto menu item
callback when mouse is moved off of menu item
Hook for attr('disabled', ...) to work. Enable or disable this menu item.
Defined by dijit._Templated

Jump to FunctionsPropertiesBack to top

Overrides dijit._Widget
attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM. For example, calling attr('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title. attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a: - DOM node attribute focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus - DOM node innerHTML title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML - DOM node CSS class myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className If the value is an array, then each element in the array matches one of the formats of the above list. There are also some shorthands for backwards compatibility: - string --> { node: string, type: "attribute" }, for example: "focusNode" ---> { node: "focusNode", type: "attribute" } - "" --> { node: "domNode", type: "attribute" }
Defined by dijit._Widget
HTML class attribute
Defined by dijit._Widget
Designates where children of the source dom node will be placed. "Children" in this case refers to both dom nodes and widgets. For example, for myWidget: <div dojoType=myWidget> <b> here's a plain dom node <span dojoType=subWidget>and a widget</span> <i> and another plain dom node </i> </div> containerNode would point to: <b> here's a plain dom node <span dojoType=subWidget>and a widget</span> <i> and another plain dom node </i> In templated widgets, "containerNode" is set via a dojoAttachPoint assignment. containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.
Defined by dijit._Widget
Unsupported by Dijit, but here for completeness. Dijit only supports setting text direction on the entire document. Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir) attribute. Either left-to-right "ltr" or right-to-left "rtl".
if true, the menu item is disabled if false, the menu item is enabled
This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's dojoAttachPoint syntax, but the domNode property is the canonical "top level" node in widget UI.
class to apply to div in button to make it display an icon
Defined by dijit._Widget
a unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.
menu text
Defined by dijit._Widget
Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
Defined by dijit._Widget
pointer to original dom node
Defined by dijit._Widget
HTML style attribute
Defined by dijit._Templated
a node that represents the widget template. Pre-empts both templateString and templatePath.
Defined by dijit._Templated
Path to template (HTML file) for this widget relative to dojo.baseUrl
Overrides dijit._Templated
a string that represents the widget template. Pre-empts the templatePath. In builds that have their strings "interned", the templatePath is converted to an inline templateString, thereby preventing a synchronous network call.
Defined by dijit._Widget
Defined by dijit._Templated
should we parse the template to find widgets that might be declared in markup inside it? false by default.
Defined by dijit._Widget
attributeMap addendum for event handlers that should be connected only on first use

Navigating the Dojo API Tool

There are several different methods of navigating through the object structure of the Dojo Toolkit:

  • Use the namespace list (to the left). The simplest method would be to use the list of namespaces defined by the Dojo Toolkit, on the left side of every page.
  • Drill-down from where you are. The API Tool was designed to give you as much information via drill-down as possible. Everything defined in an object can be clicked on, for more information.
  • Use the search. At the top of the namespace list to the left is a search box; type in the terms you are looking for, and you will be taken to a result page that spans the entire toolkit.
Move to different sections

In addition, objects with large numbers of contained types have a simple way of jumping to sections on a page; simply look at the right side of any heading, and you will see a set of quick navigation icons. Clicking a type icon will take you to that section; clicking the up arrow icon will return you to the top of the page.

Inherited and private members

Show or hide variable types

The Dojo API Tool will show the full ancestry of an object's members (including how that member was defined and whether or not it overrides an original). By default, all members of an object that are inherited are shown with the object's API listing, and all private members are hidden.

To toggle either inherited or private members, look just beneath the breadcrumb bar (above the name of the object you are viewing) and click the appropriate link.

Switching styles

Choose a style

The Dojo API Tool was designed with several themes in mind; we know that some people prefer light on dark, while others might prefer dark on light. With this in mind, two themes (Noir and Blanc) are currently available, with more on the way.

To switch visual styles, click on the theme you want to use, near the top right corner of the page. The API Tool will remember which style you prefer and automatically load that theme on subsequent visits.

Key/Legend

Namespace Namespaces
A namespace in Dojo parlance is an object/property bag that can contain almost anything: constructors, methods, properties, etc. Usually is expressly defined to serve a particular purpose; for example, dojo.date.locale is a namespace defined to deal with locale-specific date handling.
Constructor Constructors
A constructor is a function designed to create instances of objects. With the Dojo Toolkit, there are two ways of creating constructors: the "old school" way (i.e. defining a function with the this keyword in the body) or using dojo.declare.
Singleton Singletons
A singleton is a constructor that is defined and then immediately executed so that only one instance may ever exist during an application's lifetime. Usually this is done to capture some information in the environment, or to ensure a set of private variables that cannot be accessed from outside of the declaration. Examples include dojox.encoding.crypto.Blowfish.

Data Types

Array Array
Arrays are ordered lists, native to Javascript.
Boolean Boolean
Native data type representing a simple "true/false" value.
Date Date
Native Javascript data type to handle common date and time representations.
DOMNode Node
An object that represents any kind of element being referenced/used by Javascript code. Note that the type of element is not dictated by this data type; only that it is a node of some sort.
Error Error
A special, native Javascript object used to indicate an error in code. Can be subclassed and used in conjunction with the throw statement, i.e. throw new MySubError(...);
Function Function
Functions/methods are pieces of invocable code; in JavaScript, they are also considered data and can be passed around like any other object.
Number Number
A Number object is used to represent any kind of numeric value; note that Javascript does not guarentee the actual underlying datatype (though the most common is a 64-bit float).
Object Object
Objects are the base data type of Javascript. With the Dojo API Tool, a type that cannot be determined is usually marked with this icon, in addition to straight objects.
Regular Expression RegExp (Regular Expression)
A regular expression is an object used for fast string search and parsing.
String String
A string is any sequence of characters.

Input formats

  • Filtered HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

      This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy.

      For more information see W3C's HTML Specifications or use your favorite search engine to find other sites that explain HTML.

      Most unusual characters can be directly entered without any problems.

      If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML's entities page.

    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • PHP code:
    • Using custom PHP code

      If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.

      Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.

      Notes:

      • You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.
      • register_globals is now set to off by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.
      • You can either use the print or return statement to output the actual content for your item.

      A basic example:

      You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:

      print t("Welcome visitor, ... welcome message goes here ...");
      								

      If we are however dealing with a registered user, we can customize the message by using:

      global $user;
      if ($user->uid) {
      	print t("Welcome $user->name, ... welcome message goes here ...");
      }
      else {
      	print t("Welcome visitor, ... welcome message goes here ...");
      }
      								

      For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.

  • Full HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • Markdown:
    • Quick Tips:
      • Two or more spaces at a line's end = Line break
      • Double returns = Paragraph
      • *Single asterisks* or _single underscores_ = Emphasis
      • **Double** or __double__ = Strong
      • This is [a link](http://the.link.com "The optional title text")
      For complete details on the Markdown syntax, see the Markdown documentation.