Titanium Community Questions & Answer Archive

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

Ti.include and passing data oddity

I have a method that loads a page:

...
formList: function(data) {
     ... code here ...
}
...

The data argument is passed correctly and the code inside the function can use it. However if I do:

...
formList: function(data) {
     Ti.include('someFile.js');
}
...

Then it's no longer usable. "var data cannot be found".

What am I missing?

— asked September 15th 2010 by Rick Blalock
  • data
  • include
  • passing
0 Comments

2 Answers

  • Does the problem persist if someFile.js is empty? (ie see if you can rule out a conflict with the contents of that file)

    — answered September 15th 2010 by James K
    permalink
    0 Comments
  • Yes. I've removed everything and tried just the same before.

    It's odd because any vars that are defined INSIDE the function will work.

    So if I reassign the argument:

    formList: function(data) {
        var weirdProblem = data;
         Ti.include('someFile.js');
    }
    

    It'll work.

    Also, I did forget to mention the include is referencing a file a directory back. so it's more like Ti.include('../views/someFile.js'); I only mention that because I've seen Ti.include do weird things in the past

    — answered September 15th 2010 by Rick Blalock
    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.