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

  • SEARCH
  • Home
  • 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 8042901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:44:22+00:00 2026-06-05T04:44:22+00:00

I have a tree panel and for each node i have single click and

  • 0

I have a tree panel and for each node i have single click and double click events. but when i double click it is firing the single click event also. so how to prevent firing single click event when double clicked?

  • 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-05T04:44:23+00:00Added an answer on June 5, 2026 at 4:44 am

    Generally using both single click and double click events is considered a bad practice and highly discouraged.

    However, if you still want to do this, the only way to be able to distinct between single click and double click is to artificially add this distintion by measuring time between clicks.

    The idea is that you don’t do your single-click action right away but wait for a second click. If second click comes shortly, then your double click action gets triggered. Otherwise your single click action gets triggered after the delay.

    Your code will look something like:

    var singleClickTask = new Ext.util.DelayedTask(singleClickAction),  // our delayed task for single click
        singleClickDelay = 100; // delay in milliseconds
    
    function onClick() {
        singleClickTask.delay(singleClickDelay);
    }
    
    function onDblClick() {
        // double click detected - trigger double click action
        doubleClickAction();
        // and don't forget to cancel single click task!
        singleClickTask.cancel();
    }
    
    function singleClickAction() {
        // something useful...
    }
    
    function doubleClickAction() {
        // something useful...
    }
    
    
    // setting event handlers on an Element
    elem.on('click', onClick);
    elem.on('dblclick', onDblClick);
    

    The obvious downsides are:

    • There is a delay for a single click action
    • In different OS there can be a different setting for the interval between clicks that would trigger a double click, so hard-coding singleClickDelay is not reliable
    • JavaScript timer isn’t 100% accurate and results may differ on systems with different performance

    I don’t know any better solution, and again, I discourage you from using both single and double clicks at the same time, this usually leads to a broken user experience.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tree structure where each Node has a parent and a Set<Node>
I have a tree and a table on my panel, when I click the
I have a cell tree with a SingleSelectionModel. When I click on a node,
I have a tree panel and I want to show context menu to each
I have a tree panel and I would like to associate an action to
I have a JTree on the left side of the frame. Each node in
I have a tree view. I am creating the tree view items dynamically. Each
I have a tree panel which loads data after a keystroke in a text
I have a Ext.tree.Panel and define in it I have a store . I
I have a tree panel in an ExtJS4 application and I want to change

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.