-
2 Apr 2011 11:36 AM #1
Can't get contextmenu/click event working
Can't get contextmenu/click event working
Hi guys
I'm having trouble getting the contextmenu event working in the beta...
Basically I want to make my own right click menu. But I couldn't get the contextmenu event to fire. So I tried a simple click event instead and that won't fire either:
I can, however, add a listener for the render event that'll actually fire. In the API docs events such as "click" and "contextmenu" aren't even listed anymore.Code:Ext.onReady(function(){ var panel = new Ext.panel.Panel({ title: 'Editor', renderTo: 'editor', width: 600, height: 300, layout: 'fit', listeners: { click: function(e){ console.log("Click"); } } }); });
What am I missing?
-
3 Apr 2011 9:30 AM #2
Click is a DOM event.
Do you want to add a listener to the Panel's header? It's toolbar?
Or, do you really mean that you want to add a listener to the Panel's body element?Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
3 Apr 2011 10:11 AM #3
Yes, what I really mean is that I want to add the event listener to the panl's body element.
-
6 Apr 2011 12:38 AM #4
I would really appreciate an example, if you would be so kind.
-
6 Apr 2011 12:50 AM #5
Here is an example:
Code:var panel = Ext.createWidget('panel', { bodyPadding: 7, width: 300, height: 300, border: true, title: 'Panelwith custom Cls', html: 'Some content', bodyCls: 'customCls', bodyStyle: 'color:red', renderTo: Ext.getBody() }); panel.body.on('click', function() { console.log('click'); }); panel.body.on('contextmenu', function() { console.log('contextmenu'); });vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
6 Apr 2011 2:57 AM #6
Thank you, Steffen!
But, suppose I wanted to listen for the contextmenu event on the body of an Ext.form.HtmlEditor? It doesn't have a body property, and bodyEl doesn't seem to work.
-
6 Apr 2011 3:23 AM #7
this won't work as the htmlEditor is an iframe, you can explore yourself:
Code:Ext.fly(ed.getEditorBody())
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
Similar Threads
-
handler/click event not working when clicked in IE7
By amodg in forum Ext 3.x: Help & DiscussionReplies: 10Last Post: 4 Aug 2011, 4:20 AM -
ContextMenu: right click on grid
By hallikpapa in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 8 Sep 2009, 10:57 AM -
Now "right-click" or "contextmenu" event on Button?
By dbassett74 in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 11 Jul 2009, 10:19 AM -
very slow response to contextmenu click by menuitem click event handler
By mxu in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 3 Mar 2008, 1:46 PM


Reply With Quote