JavaScript
Run Code
Open in Fiddle
Ext.application({ name : 'Fiddle', launch : function() { var getMenu = function (cmp) { var menu = cmp.down('menu'); if (!menu) { menu = Ext.create('Ext.menu.Menu', { itemId: 'banneroptionmenu', items: [{ text: 'Text 1' },{ text: 'Text 2' }] }); } return menu; }; Ext.create('Ext.panel.Panel', { height: 200, renderTo: document.body, title: 'A Panel', layout: 'fit', listeners: { 'render': { fn: function() { this.body.on('click', this.handleClick, this); }, single: true, } }, handleClick: function(e, t){ var testpanel = this.up('#mainPanel'); var buttonPanel = this.up('#buttonPanel'); if(testpanel != null) { if (buttonPanel != null) { getMenu(owner).showBy(buttonPanel,'tr-br?'); } } } }); } });