Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    23
    Vote Rating
    5
    bill@perdasys.com is on a distinguished road

      0  

    Default Add TAP/CLICK event to IMAGE component

    I find that I have needed to add a Custom Listener Event abstractcomponent.getEl().on('click', function() { ...}
    to the onRender event of IMAGE component several time. IMAGE does not have a CLICK or TAP event. Can this be added to architect since I cannot use MVC without a valid event to select.

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Relay the event.

    Ie subscribe to the element-level event and fire another, component-level event. You can then subscribe to that event via a controller.
    Aaron Conran
    @aconran

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    23
    Vote Rating
    5
    bill@perdasys.com is on a distinguished road

      0  

    Default

    Not 100% sure what you are saying.
    Ie subscribe to the element-level event and fire another, component-level event


    It sounds like you want my custom listener to just fire an event that is defined for the Image Component. I still would have to code a listener for the click event. Yes I could code up using MVC for the OnRender event, but this seems a bit of a hack. What I have works, but just wanted to see if Click/Tap could be added, if not then so be it.

    If I am incorrect, Can you give me an example?.

    Would it not be easier going forward to just add TAP or CLICK to the events that can be selected so that the Image component works the same as other clickable components or would this require a change to the EXTJS framework and not really an Architect issue?



  4. #4
    Sencha User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
    wsilvius is on a distinguished road

      0  

    Default

    I have exactly the same "problem". I need to use "onclick" event on img component but i still don't find answers on web.
    Do you find any info on web?

  5. #5
    Sencha User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
    wsilvius is on a distinguished road

      0  

    Default Solve

    Quote Originally Posted by wsilvius View Post
    I have exactly the same "problem". I need to use "onclick" event on img component but i still don't find answers on web.
    Do you find any info on web?
    Finally, I was able to solve the puzzle.
    Add Event Binding "afterrender" on IMG object, add code inside function:
    abstractcomponent.getEl().on('click', function() {
    //your code
    });
    ..and done..!
    Attached Images

  6. #6
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    140
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default

    Quote Originally Posted by bill@perdasys.com View Post
    or would this require a change to the EXTJS framework and not really an Architect issue?
    Yes, the image component does not expose a tap or click event at this time.
    Aaron Conran
    @aconran

Thread Participants: 2