因此,我有一个脚本可以创建一个简单的表视图,但是更改简单的字符串似乎会产生严重的后果。
这项工作(我将其剥离到相关部分):
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);
...
但是将
title: rows.fieldByName('first_name'),
更改为title: rows.fieldByName('first_name') + rows.fieldByName('last_name'),
会引发错误Result of expression 'win.add' [] is not a function. at persons.js (line 32)
(第32行是win.add(tableview)
。唯一的区别是该行,但它会使整个脚本失败。
提前致谢
弗雷德
最佳答案
您是否尝试在它们之间留出空白?title: rows.fieldByName('first_name') + ' ' + rows.fieldByName('first_name')
如果您从桌子上拿另一张桌子?像last_name一样,它也会崩溃吗?