Titanium Community Questions & Answer Archive

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

Focus event not firing on the original window when the modal is closed

I can't get the "Focus" event to fire on a window once the modal has been closed. What reason/s might this be happening?? I need the data on the original window to automatically update when data has been selected on the modal. How can I fix this??

Thanks in advance!!

— asked September 6th 2010 by ryan am
  • addeventlistener
  • events
  • iphone
  • modal
  • window
0 Comments

5 Answers

  • Something like:

    function my_update() {
    // do your stuff here
    }
    
    the_modal_win.addEventListener('close', function(){
    my_update();
    })
    

    of course you will have to store all the data you are modifying in the modalwin to be accessible by the function my_update.
    ~~~

    — answered September 7th 2010 by Dan Tamas
    permalink
    1 Comment
    • This is exactly what I [am forced to] use to trigger a "focus" to parent window.

      — commented October 15th 2010 by Swaroop Hegde
  • Can't you trigger a custom "update" event when the modal closes? ( so on the modal's clase event) ?

    — answered September 6th 2010 by Dan Tamas
    permalink
    0 Comments
  • Thanks Tamas…I'm having trouble trying to update the labels on the original window with info created on the modal. Do you have an example maybe? Sorry I'm a beginner.

    — answered September 7th 2010 by ryan am
    permalink
    0 Comments
  • Thanks Tamas…I'm having trouble trying to update the labels on the original window with info created on the modal. Do you have an example maybe? Sorry I'm a beginner.

    — answered September 7th 2010 by ryan am
    permalink
    0 Comments
  • The reason this is happening is because Titanium quality control is a joke and every update adds back bugs which were 'fixed' in the previous one.

    One strategy which will overcome your problem is to use the 'open' event instead of the 'focus' event (so far, Titanium still recognises an open event…).

    When you close the modal window, force another open on the original window which will update your data. Instructions on how to do this from the modal 'close' event can be found in the documentation under 'Window'.

    Regards, JH

    — answered September 7th 2010 by John Holman
    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.