DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu
Event Handling

## onBeforeContextMenu Event

This event occurs before the moment when a contextual menu appears by a right mouse click. onBeforeContextMenu event can call a user-defined handler (if there is any) and pass the following parameter:

- zoneId - id of the contextual menu zone.

            menu.attachEvent("onBeforeContextMenu", function(zoneId){
                ... // user-defined handler
                return true;
            });

When the user attaches a user-defined handler to this event, the state of the item can no longer be changed automatically. The user can control this by returning true|false from a user-defined handler. That's why return true should be added after user-defined handler, in order to let the script know that the state of the item should be changed.