Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:28:29+00:00 2026-06-11T22:28:29+00:00

I would like to add a double click event to a panel. How would

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:28:31+00:00Added an answer on June 11, 2026 at 10:28 pm

    The double click event is not an event of Ext.Components, it’s an event of Ext.Element. Since Ext.Components render Ext.Elements they provide a way for you to set handler on those elements the component creates without having to wait for the render event.

    Just set a listener for the dblclick event, specifying which Ext.Element in your panel you want to handle. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Panel-method-addListener

    Here’s an example: http://jsfiddle.net/eVzqT/

    new Ext.Panel({
        html: 'Here I am',
        title: 'Title',
        width: 400,
        height: 500,
        listeners: {
            dblclick : {
                fn: function() {
                     console.log("double click");
                },
                // You can also pass 'body' if you don't want click on the header or
                // docked elements
                element: 'el'
            }    
        },
        renderTo: Ext.getBody()
    });​
    

    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

    new Ext.Panel({
        html: 'Here I am',
        title: 'Title',
        width: 400,
        height: 500,
        listeners: {
            dblclick : {
                fn: function(e, t) {
                     this.fireEvent('dblclick', this, e, t);
                },
                // You can also pass 'body' if you don't want click on the header or
                // docked elements
                element: 'el',
                scope: this
            }    
        },
        renderTo: Ext.getBody()
    });​
    

    That could be abstracted into a plugin

    /**
     * Adds an Ext.Element event to a component
     * could be improved to handle multiple events and to allow options for the event
     */
    Ext.define('my.plugin.ComponentElementEvent', {
        extend: 'Ext.AbstractPlugin',
        alias: 'plugins.cmp-el-event',
    
        /**
         * @cfg {String} eventName Name of event to listen for, defaults to click
         */
         eventName: 'click'
    
        /**
         * @cfg {String} compEl Name of element within component to apply listener to
         *      defaults to 'body'
         */
         compEl: 'body',
    
        init: function(cmp) {
           cmp.on(this.eventName, this.handleEvent, this, {element: this.compEl});
    
        },
        handleEvent: function(e,t) {
            this.getCmp().fireEvent(this.eventName, this.getCmp(), e, t);
        }
    });
    

    And you could use the plugin like the following

    // This panel fires a dblclick event that can be handled from controllers.
    new Ext.Panel({
        html: 'Here I am',
        title: 'Title',
        width: 400,
        height: 500,
        plugins: [{ptype: 'cmp-el-event', eventName: 'dblclick', compEl:'el'}
        renderTo: Ext.getBody()
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that contains some data, and I would like to add
I've created an .ics file with multiple events that I would like to add
I have a line that I would like to add to a Path but
I have own project and i would like add for this class same as
I have a ListView and each item have a TextView. I would like add
I would like to add talkPrice, textPrice and dataPrice and have the total be
I would like to add a method to a built-in type (e.g. Double), so
I would like to add a GestureDetector to all views (view groups) of an
I would like to add a custom calculation method to a managed object (which
I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.