Results 1 to 6 of 6

Thread: Event Listeners

  1. #1
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    175

    Default Event Listeners

    I understand that two different objects extending the observable interface are unable to listen to each others events, so what is the best way to allow 2 distinct components to listen to each others events?

    The scenario, is that I have 2 components. The first is a table of projects the second is a component to create a new project. I want an event to fire when a new project is created such that the project table is automatically refreshed.

    I'm not looking for source, just point me in the right direction or a description that this is even possible. I can do this by calling methods directly, but the concept will be a large part of the application I am writing so I'd like to understand my options first.

    BTW: extJS is amazing.

    Thank you.
    Dean.

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Quote Originally Posted by Bleak View Post
    I understand that two different objects extending the observable interface are unable to listen to each others events
    Dean.


    Why? You can add listeners to any Observable's event. It's just a function that gets called.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    175

    Default

    This is good news.. I thought I must be missing something.

    Any chance you have some skeleton code that shows one object listening to another object's event?

  4. #4
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    Code:
    anyComponent.on('someEvent', this.handleThatEvent, this);

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    175

    Default

    Awesome.. It seems to simple

    Appreciate the quick response, I'll give that a shot.

  6. #6
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    the "this" reference is the scope for which you want the event handler to be called.

Posting Permissions

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