Results 1 to 6 of 6

Thread: Help~~ how to remove tap event ( element.on )

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default Unanswered: Help~~ how to remove tap event ( element.on )

    Hi I use element.on to bind tap event ,
    but I want to remove this event after tap and bind another tap event on it ...

    Below is my code ..

    container.on('tap',function(){
    alert('a');
    this.un('tap');
    this.on('tap',function(){
    alert('b');
    });
    });

    I can't remove tap event and that will alert a and alert b .
    Could anyone can help on this problem ?

    Thank you very much : )

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    100
      0  

    Default

    I'm a little confused. Do you want to just call a custom function on the tap event? I'm not sure if containers can fire a tap event. I think only dom elements can respond to tap events because its a dom event.

    See these for more info:
    http://www.sencha.com/forum/showthread.php?230402-adding-tap-handler-to-Container-component
    http://www.sencha.com/forum/showthre...ent-to-a-panel

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Sorry ..the code has some problem ..

    container.element.on('tap',function(){
    alert('a');
    this.un('tap');
    this.on('tap',function(){
    alert('b');
    });
    });

    I use dom element to bind tap event but I can't remove it ...
    Please help me ~~ Thank you very much

  4. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    100
      0  

    Default

    Why are you listening for an event if you want to remove it? Shouldn't you just fire your own tap event when it's tappped?

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    hi Jerome ~

    I have a header container when click it in first page that will show a floating city list .
    but when in other page I need to back first page when click header container .
    So ... I hope all page can use one header but header's event need to change when not in first page.
    I try to use "un" function to remove event but it can't work ... in the sample code that will alert A then alert B ...

    Below is the design sample : )


    First Page :
    Header Header
    (show city list)- tap
    ----------
    Content

    Second Page
    (back to first Page)- tap
    ----------
    Detail information


    Do you have any idea ?
    Thank you for your respond : )

    Cheers

  6. #6
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    100
      0  

    Default

    What exactly are you using for your 'header'? I think you should just use a button to navigate between pages. It would be more intuitive for the users that way. Then you could reference the button and change the 'handler' by using setHandler(function(){...})

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
  •