Note that there are some explanatory texts on larger screens.

plurals
  1. POSencha Touch: Button handler called twice for single click - why?
    primarykey
    data
    text
    <p>My button handler gets called twice - once for mousedown/touchstart and a second time for mouseup/touchend.</p> <p>This happens both on my iPhone device and in my Chrome Browser.</p> <p>Using ST 1.1</p> <p>I haven't found any references to this problem which seems to suggest that something in my env is wrong, but I'm running out of things to check ...</p> <p>Examining the event objects passed to the handler in Chrome DevTools I can see that they're both simulated "tap" events, the first originating from "mousedown" and the second from "mouseup".</p> <p>Any ideas ?</p> <p><strong>EDIT:</strong></p> <p>I've found out that this happens when I add a call (even with an empty handler) to <code>Ext.EventManager.onDocumentReady</code>.</p> <p>If I remove this call, I only get clicks on "mouseup" as expected.</p> <p>If I replace it with <code>Ext.onReady</code> it works !!! This is really bewildering since one is an alias for the other ...</p> <p>code reproduction:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;script src="resources/Sencha/sencha-touch-debug.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link href="resources/Sencha/sencha-touch.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript"&gt; MyPanel = Ext.extend(Ext.Panel, { fullscreen: true, initComponent: function() { this.items = [{ xtype: 'button', text: 'Login', handler: this.myHandler, scope: this }]; MyPanel.superclass.initComponent.apply(this, arguments); }, myHandler: function(b, e) { console.log(e.event.type); } }); Ext.EventManager.onDocumentReady(function() { }); Ext.onReady(function() { new MyPanel(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt;&lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload