So I have a script which creates a simple table view, but changing a simple string seems to have drastic consequences.
This works (I have stripped it to the relevant parts):
data = [];
db = Ti.Database.install('../data.sqlite', 'person');
rows = db.execute('SELECT * FROM person');
while (rows.isValidRow()) {
data.push({
title: rows.fieldByName('first_name'),
hasChild: true,
c_id: rows.fieldByName('C_ID')
});
rows.next();
}
tableview = Titanium.UI.createTableView({
data: data
});
...
win.add(tableview);
...
But changing title: rows.fieldByName('first_name'), to title: rows.fieldByName('first_name') + rows.fieldByName('last_name'), throws an error of
Result of expression 'win.add' [] is not a function. at persons.js (line 32) (line 32 is win.add(tableview).
The only difference is that line but it makes the whole script fail.
Thanks in advance
Fred
I found the problem, it was because I’m using coffeescript which wraps the code in a function wrapper, which causes problems (somehow). Removing the function wrapper fixed it but now I can’t use coffeescript any more.