I would like to add a double click event to a panel. How would I do that? So I have a panel with some html, no other events or clickable items, and I want to be able to capture a double click.
Actually any component that can display a large chunk of html would be okay as long as I can double click it.
I’ve searched Sencha’s docs and there aren’t many components with double click events.
The double click event is not an event of
Ext.Components, it’s an event ofExt.Element. SinceExt.ComponentsrenderExt.Elements they provide a way for you to set handler on those elements the component creates without having to wait for therenderevent.Just set a listener for the
dblclickevent, specifying whichExt.Elementin your panel you want to handle. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Panel-method-addListenerHere’s an example: http://jsfiddle.net/eVzqT/
If you want to be able to handle the event from a controller, you need to relay the event from the element to the component
That could be abstracted into a plugin
And you could use the plugin like the following