# dhtmlxmenu:api_constructor_object [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu
API Methods

## List of initialization properties

### Common initialization options

- parent - string or object, id of container, where tree will be initialized, mandatory
- image_path - string, path to image folder, which will be used for icons in tree
- skin - {string} changes menu skin(setSkin)

- align - {string} set top level menu align(setAlign)
- auto_hide - {boolean} sets to false to prevent hiding a contextual menu by a click(setAutoHideMode)
- auto_show - {boolean} sets to false to prevent showing a contextual menu by a click(setAutoShowMode)
- caption - {string} set top level additional text (in case of usual menubar)(setTopText)
- context - {boolean} renders menu as contextual(renderAsContextMenu)
- dynamic - {string} enables dynamic loading of sublevels(enableDynamicLoading)
- icon_path - {string} defines an url where necessary user embedded icons are located(setIconsPath)
- open_mode - {string} sets open mode for the menu(setOpenMode)
- rtl - {boolean} set right-to-left mode(setRTL)
- xml - {string}, url of data xml file

### Menu's items

menu items can be defined through items collection

    menu = new dhtmlXMenuObject({
    		parent:"a_menu",
    		items:[
                       {id:"t1", text:"Top 1", items:[
                             {id:"ch1", text:"child 1"},
                             {id:"ch2", text:"child 2"}
                       ]}
                    ]
    	});

Each item can have next attributes

- id - {string} id of menu item
- text - {string} caption of menu item
- img - {sting} url of image related to menu item
- disabled - {boolean} disabled state
- img_disabled - {sting} url which will be used for item in disabled state

### Events

any event can be assigned by using property equal to event name

    	menu = new dhtmlXMenuObject({
    		parent:"a_menu",
    		onClick:function(){
    			alert("Item was clicked");
    		}
    	});