expandcollaps

dhtmlXMenuObject object API

addCheckbox(mode, nextToId, pos, itemId, itemText, state, disabled)
adds a new checkbox, sibling|child mode

File required:dhtmlxmenu.js
  • mode - (string) sibling|child
  • nextToId - the item after which the checkbox will be added in the "sibling" mode or parent item's id in the "child" mode
  • pos - item's position in the child mode (null for sibling)
  • itemId - id of a new checkbox
  • itemText - text of a new checkbox
  • state - checked|unchecked
  • disabled - enabled|disabled
  • addContextZone(zoneId)
    adds a contextual zone to a contextual menu

    File required:dhtmlxmenu.js
  • zoneId - id of the object on page to render as a contextual zone
  • addNewChild(parentId, pos, itemId, itemText, disabled, imgEnabled, imgDisabled)
    adds a new child item

    File required:dhtmlxmenu.js
  • parentId - the item which will contain a new item in the sublevel
  • position - the position of a new item
  • itemId - id of a new item
  • itemText - text of a new item
  • disabled - true|false, whether the item is disabled or not
  • img - image for the enabled item
  • imgDis - image for the disabled item
  • addNewSeparator(nextToId, itemId)
    add a new separator

    File required:dhtmlxmenu.js
  • nextToId - id of the element after which a new separator will be inserted
  • itemId - id of a new separator
  • disabled - true|false, whether the item is disabled or not
  • addNewSibling(nextToId, itemId, itemText, disabled, imgEnabled, imgDisabled)
    adds a new sibling item

    File required:dhtmlxmenu.js
  • nextToId - id of the element after which a new one will be inserted
  • itemId - id of a new item
  • itemText - text of a new item
  • disabled - true|false, whether the item is disabled or not
  • img - image for the enabled item
  • imgDis - image for the disabled item
  • addRadioButton(mode, nextToId, pos, itemId, itemText, group, state, disabled)
    adds a new radio button, sibling|child mode

    File required:dhtmlxmenu.js
  • mode - (string) sibling|child
  • nextToId - the item after which the radio button will be added in the "sibling" mode or parent item's id in the "child" mode
  • pos - the item's position in the child mode (null for sibling)
  • itemId - id of a new radio button
  • itemText - text of a new radio button
  • group - radiogroup's id
  • state - checked|unchecked
  • disabled - enabled|disabled
  • clearItemImage(id)
    removes both enabled and disabled item images

    File required:dhtmlxmenu.js
  • id - the item
  • enableDynamicLoading(url, icon)
    enables dynamic loading of sublevels

    File required:dhtmlxmenu.js
  • url - server-side script, transmitted params are action=loadMenu and parentId
  • icon - true|false, replaces elemet's arrow with loading image while loading
  • getCheckboxState(id)
    returns current checkbox's state

    File required:dhtmlxmenu.js
  • id - the item
  • getHotKey(id)
    returns item's hot-key (just text)

    File required:dhtmlxmenu.js
  • id - menu item's id
  • getItemImage(id)
    returns item's image - array(img, imgDis)

    File required:dhtmlxmenu.js
  • id - the item
  • getItemPosition(id)
    returns item's position in the current polygon

    File required:dhtmlxmenu.js
  • id - the item
  • getItemText(id)
    returns item's text

    File required:dhtmlxmenu.js
  • id - the item
  • getItemType(id)
    return item type by id

    File required:dhtmlxmenu.js
  • id
  • getParentId(id)
    returns parent's id

    File required:dhtmlxmenu.js
  • id - the item
  • getRadioChecked(group)
    returns a checked radio button in the group

    File required:dhtmlxmenu.js
  • group - radio button group
  • getTooltip(id)
    returns tooltip of a menu item

    File required:dhtmlxmenu.js
  • id - menu item's id
  • getUserData(id, name)
    returns item's userdata

    File required:dhtmlxmenu.js
  • id - the item
  • name - the name of userdata (string)
  • hide()
    hides any open menu polygons

    File required:dhtmlxmenu.js
    hideContextMenu()
    usercall to hide a contextual menu

    File required:dhtmlxmenu.js
    hideItem(id)
    hides an item

    File required:dhtmlxmenu.js
  • id - the item to hide
  • isContextZone(zoneId)
    returns true if an object is used as a contextual zone for the menu

    File required:dhtmlxmenu.js
  • zoneId - id of the object to check
  • isItemEnabled(id)
    returns true if the item is enabled

    File required:dhtmlxmenu.js
  • id - the item to check
  • isItemHidden(id)
    returns true if the item is hidden

    File required:dhtmlxmenu.js
  • id - the item to check
  • loadFromHTML(objId, clearAfterAdd, onLoadFunction)
    loads menu data from an html and calls onLoadFunction when loading is done

    File required:dhtmlxmenu.js
  • object - html data container
  • clearAfterAdd - true|false, removes the container object after the data is loaded
  • onLoadFunction - is called after the data is loaded (but before clearing html content if clear is set to true)
  • loadXML(xmlFile, onLoadFunction)
    loads menu data from an xml file and calls onLoadFunction when loading is done

    File required:dhtmlxmenu.js
  • xmlFile - an xml file with webmenu data
  • onLoadFunction - a function that is called after loading is done
  • loadXMLString(xmlString, onLoadFunction)
    loads menu data from an xml string and calls onLoadFunction when loading is done

    File required:dhtmlxmenu.js
  • xmlFile - an xml string with webmenu data
  • onLoadFunction - function that is called after loading is done
  • removeContextZone(zoneId)
    removes an object from contextual zones list

    File required:dhtmlxmenu.js
  • zoneId - id of a contextual zone
  • removeItem(id)
    removes an item from the menu with all nested sublevels

    File required:dhtmlxmenu.js
  • id - id of the item for removing
  • renderAsContextMenu()
    renders menu as contextual

    File required:dhtmlxmenu.js
    setAutoHideMode(mode)
    sets to false to prevent hiding a contextual menu by a click

    File required:dhtmlxmenu.js
  • mode - true/false
  • setAutoShowMode(mode)
    sets to false to prevent showing a contextual menu by a click

    File required:dhtmlxmenu.js
  • mode - true/false
  • setCheckboxState(id, state)
    sets checkbox's state

    File required:dhtmlxmenu.js
  • id - the item
  • state - a new state
  • setHotKey(id, hkey)
    sets menu hot-key (just text)

    File required:dhtmlxmenu.js
  • id - menu item's id
  • hkey - hot-key text
  • setIconsPath(path)
    defines an url where necessary user embedded icons are located

    File required:dhtmlxmenu.js
  • path - url to images
  • setImagePath(path)
    defines an url where necessary images are located

    File required:dhtmlxmenu.js
  • path - url to images
  • setItemDisabled(id)
    disables an item

    File required:dhtmlxmenu.js
  • id - item's id to disable
  • setItemEnabled(id)
    enables an item

    File required:dhtmlxmenu.js
  • id - item's id to enable
  • state - true|false
  • setItemImage(id, img, imgDis)
    sets an image for the item

    File required:dhtmlxmenu.js
  • id - the item
  • img - the image for the enabled item (empty string for none)
  • imgDis - the image for the disabled item (empty string for none)
  • setItemPosition(id, pos)
    sets new item's position in the current polygon (moves an item inside the single level)

    File required:dhtmlxmenu.js
  • id - the item
  • pos - the position (int)
  • setItemText(id, text)
    sets text for the item

    File required:dhtmlxmenu.js
  • id - the item
  • text - a new text
  • setOpenMode(mode)
    alias for setIconsPath

    File required:dhtmlxmenu.js
  • mode - win|web, the default mode is web, in the win mode a user should click anywhere to hide the menu, in the web mode - just put the mouse pointer out of the menu area
  • setOpenMode(mode)
    alias for setIconsPath

    File required:dhtmlxmenu.js
  • mode - win|web, the default mode is web, in the win mode a user should click anywhere to hide the menu, in the web mode - just put the mouse pointer out of the menu area
  • setOverflowHeight(itemsNum)
    limits the maximum number of visible items in polygons

    File required:dhtmlxmenu.js
  • itemsNum - count of the maximum number of visible items
  • setRadioChecked(group, id)
    checks a radio button inside the group

    File required:dhtmlxmenu.js
  • group - radio button group
  • id - radio button's id
  • setTooltip(id, tip)
    sets tooltip for a menu item

    File required:dhtmlxmenu.js
  • id - menu item's id
  • tip - tooltip
  • setUserData(id, name, value)
    sets userdata for an item

    File required:dhtmlxmenu.js
  • id - the item
  • name - the name of userdata (string)
  • value - the value of userdata (usually string)
  • setVisibleArea(x1, x2, y1, y2)
    sets the area in which the menu can appear, if the area is not set, the menu will occupy all available visible space

    File required:dhtmlxmenu.js
  • x1, x2 - int, leftmost and rightmost coordinates by x axis
  • y1, y2 - int, topmost and bottommost coordinates by y axis
  • setWebModeTimeout(tm)
    sets hide menu timeout (web mode only)

    File required:dhtmlxmenu.js
  • tm - timeout, ms, 400 default
  • showContextMenu(x, y)
    usercall to show a contextual menu

    File required:dhtmlxmenu.js
  • x - position of the menu on x axis
  • y - position of the menu on y axis
  • showItem(id)
    shows an item

    File required:dhtmlxmenu.js
  • id - the item to show