Results 1 to 3 of 3

Thread: Handle double click of a button as single click?

  1. #1
    Sencha User
    Join Date
    Sep 2016
    Posts
    10

    Default Answered: Handle double click of a button as single click?

    I have a button that when you click it, it makes an ajax call and refreshes the screen. However, if the user double clicks the button, the screen flickers and doesn't display what it should. Obviously there is a timing issue because if I stop on breakpoints in the code, it will work/display as it should. Ideally the users wouldn't double click this button, but in case they do, I'd like to be able to handle it and have my page display what it should. I tried disabling the button after it was initially clicked and re-enabling, but that didn't work great for me. Then I came across DelayedTask, and I'm wondering if that's what I need.

    Also, I'm new to EXTJS, so please forgive me for not understanding everything. And, we're using extjs 4.2.2.

    Here's how the button is event is currently being set up:

    Code:
    Ext.define('controller.Header', {
        extend: 'Ext.app.Controller',
        id:'header',
        views:['header.Header'],
        stores:['StartupSettings'],
        init: function() {
            this.control({
                '#header-sectionbar button[action=showEvents]':{
                             'click': this.showEventsHandler
                         }
                  });
           }
           .
           .
           .
          showEventsHandler: function() {
             //do stuff 
             //call other methods that eventually fire off an ajax request
          }
    });
    
    
    Is the best solution for me to change it to this? It seems to work, but is it correct to do it this way? (The part I changed is in red)

    Code:
    Ext.define('controller.Header', {
        extend: 'Ext.app.Controller',
        id:'header',
        views:['header.Header'],
        stores:['StartupSettings'],
        init: function() {
            var task = new Ext.util.DelayedTask(this.showEventsHandler, this);
            this.control({
                '#header-sectionbar button[action=showEvents]':{
                            'click': function() {
                                task.delay(500);
                            }
                        }
                  });
           }
    });
    
    

  2. Have you looked at the buffer config?
    http://docs.sencha.com/extjs/4.2.3/#...-configuration

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Have you looked at the buffer config?
    http://docs.sencha.com/extjs/4.2.3/#...-configuration

  4. #3
    Sencha User
    Join Date
    Sep 2016
    Posts
    10

    Default

    That definitely sounds like what I need. Thanks!

Similar Threads

  1. Replies: 5
    Last Post: 2 Jun 2015, 5:49 AM
  2. Replies: 2
    Last Post: 25 Jan 2012, 7:49 AM
  3. Double single click and double click in editor grid problem
    By Zanisimo in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 22 Jan 2011, 12:05 PM
  4. Question on double click and single click event handlers within grid
    By NotChris in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Feb 2008, 11:51 AM
  5. Grid - Single click vs Double click select
    By amackay11 in forum Ext 1.x: Help & Discussion
    Replies: 13
    Last Post: 4 Jun 2007, 5:16 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •