Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Passing data from child window to parent

I have a tableviewrow, i added a click event that opens a new window. When the new child window is closed, i would like to pass back to the parent tableviewrow a value. How can I do this? I see how to pass data from the parent tableviewrow to the child window it spawns, but now I need the data to go back from child to parent since it can be changed on the child window.

— asked September 24th 2010 by B Ben
  • child
  • data
  • parent
  • passing
  • windows
0 Comments

1 Answer

  • Accepted Answer

    You will want to use events to pass back to the parent. This developer blog entry should help.

    Basically the parent needs an event listener like:

    Ti.App.addEventListener('myCustomEvent', function(event) {
      Ti.API.info('You sent me: '+event.myCustomEventValue);
    });
    

    The child needs to fire an event:

    Ti.App.fireEvent('myCustomEvent', {
      myCustomEventValue: 'someValue'
    });
    
    — answered September 24th 2010 by Mike Robinson
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.