View Full Version : contextmenu event

11 Dec 2011, 9:18 PM
According to the API docs, tabs, tabbar, toolbar, and buttons have no 'contextmenu' event. Why is that?

My use-case is to prevent the user from seeing the context (right-click) menu from popping up on certain components such as the button. Additionally, I would like to process events on the tabs and/or toolbars when there is a right click...

11 Dec 2011, 11:19 PM
Every root/parent component's element has a contextmenu event, so just get it and and make what ever you want with it, even preventing of not showing the pop-menu on right click.

12 Dec 2011, 3:56 AM
To expound a little on what vadimv has already said, you should be able to do something like this:

listeners: {
el: {
contextmenu: function() {

The events click and contextmenu generally aren't exposed on components as they add little value to what can be done directly with the element. The main exception to this is view-based components, where quite a lot of useful extra information can be passed to the handler regarding the corresponding record. A few other components also expose the click event if clicking is fundamental to what they do, for example buttons and menu items.