Titanium Community Questions & Answer Archive

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

[BUG] Android - Passing Data

Hi,

there is a section about passing data between windows in the documentation. This technique does not work for Android, I get this Runtime Error:

TypeError: Cannot call property testFn in object ti.modules.titanium.ui.WindowProxy@43e99d18. It is not a function, it is "object".

Is there any solution for this problem?

Does accelerator team know about this bug?
(I could not find any ticket which refers to this problem)

Thanks in advance for your help.

— asked May 5th 2010 by Lukasz Radziwonowicz
  • android
  • data
  • passing
  • window
0 Comments

2 Answers

  • Accepted Answer

    Thanks for bringing this back to our attention. I've added Ticket 882 for tracking.

    — answered May 5th 2010 by Don Thorp
    permalink
    0 Comments
  • I have also had this issue. My workaround is to create the functions in another helper .js file that I included on every page.

    ex:

    var myData = Ti.UI.currentWindow.myData

    myData.setX = function(x) {this.x = x};

    I would also like to add that there is a another problem passing data this way to windows. The passed data is not copied via reference so the changes made to the object by the calling window are not available to the caller. currentWindow seems to create a COPY of the object and returns that. A good example:

    var myData = {x:0}

    var win = Titanium.UI.createWindow({
        url: 'window2.js',
        myData: myData
    });
    

    win.open();

    //then in the calling window:

    Ti.UI.currentWindow.myData.x = 1

    //This will return 0 still even though we just changed it to 1
    Ti.API.info(Ti.UI.currentWindow.myData.x)

    — answered May 5th 2010 by Vinh Bui
    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.