Results 1 to 2 of 2

Thread: Removing standard event handlers (ST1 vs. ST2)

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    69
    Answers
    1

    Default Removing standard event handlers (ST1 vs. ST2)

    Hi,

    I had this code in ST1 and it worked fine:
    Code:
    this.un('itemtap', this.onItemTap, this);
    this.on('itemtap', this.handleItemTap, this);
    This code was inside 'initComponent', now 'initialize' and it works for NestedList.
    What I need is to prevent going deeper into the tree structure on ItemTap, so I have some logic inside handleItemTap, and then when needed, I can fire original onItemTap function.
    Now original event handler is not removed.... is there some problem with the scope...?

    Thanks for any help!

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    69
    Answers
    1

    Default

    Ok, I thought that was rather simple question. Maybe I have asked it in a wrong way, so...
    1) I know how to remove events added by me, thats straight forward:
    Code:
    this.on('itemtap', this.handleItemTap, this);
    this.un('itemtap', this.handleItemTap, this);
    Custom event listener is added and removed as expected.

    2) Why the above does not work for "predefined" event listeners (and it worked in the past?)
    Code:
    this.un('itemtap', this.onItemTap, this);
    this.on('itemtap', this.handleItemTap, this);
    Custom listener is added, but original is not removed, why? (and how should I remove it?)

Posting Permissions

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