Results 1 to 3 of 3

Thread: Programmatically Fire Element Events

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Vote Rating

    Default Programmatically Fire Element Events

    Hi everyone


    Is it possible in Sencha Touch 2.1 to programmatically fire Ext.event.Event events within the framework?

    In the API docs example at Ext.event.Event, I see how to get access to an event object.!/api/Ext.event.Event

    In the Ext.event.Event example, the listener has access to an event object (e) which contains all the information about the browser event that occurred (type such as mouseup-mousedown, position in x y, etc).

    How can we take this event object and programmatically fire it again?


    My attempts have all used private methods within the framework. I have tried to access the the DOM event publisher at Ext.event.Dispatcher.getInstance().getPublishers().dom , and then call its onEvent() method with the event object that was used in the first place. It does not work. I suspect that one problem will be that the timestamps of the recorded event are in the past. Another problem is that the events could be batched up before processing. I have tried doing the same thing with the Touch Gestures publisher with some luck.

    Doing things like this is not good because it requires a thorough understanding of the internals (which I dont have) and private methods may change over time. I dont have a good understanding of how Sencha Touch takes a browser event and causes an event on an Ext.dom.Element followed by events on Ext.Components.

    Id much rather a solution that uses only public methods.

    Ive also tried to get the Ext.dom.Element by id using Ext.get(id), and then firing the event with the same name (tap, touchstart, single tap). No luck with this either. I need to investigate what the arguments should be for the fireEvent.

    The goal, as always, is to use as much of the framework as possible.


    Advice on how my attempts are totally wrong or could be improved!

    Information about the internals of the framework with regard to browser events and event publishing would be extremely helpful.

    Let me know if this whole idea is not possible
    Is it only possible if we listen for events on Components, and then fire events back on the element
    property (Ext.dom.Element)?

    Information about Ext.dom.Element and Ext.dom.Publisher specifically

    Information about the abstraction layers of the framework DOM->Ext.dom.Element->CompositeElement->Component?

    Information explaining how Ext.Js does it with injectEvent


    This has been done in Ext.Js. Ext.Js 4 provides an injectEvent() method that is similar to what I want to do.

    Ext.Js also provides an Ext.ux.event.Recorder which I believe is related to this; however I have not seen examples of it being used.

    This idea resembles what has been described for Ext.js several years ago at
    and may have been implemented as injectEvent.

    Any and all help is appreciated
    Last edited by kotarf; 6 Dec 2012 at 1:01 PM. Reason: correcting bad inconsistencies!

Posting Permissions

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