Titanium 钛JS:使用合金数据绑定时出错:';未定义';不是对象(在';上计算';u alloyId60.on)

Titanium 钛JS:使用合金数据绑定时出错:';未定义';不是对象(在';上计算';u alloyId60.on),titanium,titanium-mobile,appcelerator,titanium-alloy,Titanium,Titanium Mobile,Appcelerator,Titanium Alloy,我用钛合金创建了一个新的控制器(search.js),其中我引用了我的一个收藏: search.js var searchResults = Alloy.Collections.searchResults; <TableView id="resultsTable" dataCollection="searchResults"> <TableViewRow title="{name}" /> </TableView> _.each(results,

我用钛合金创建了一个新的控制器(
search.js
),其中我引用了我的一个收藏:

search.js

var searchResults = Alloy.Collections.searchResults;
<TableView id="resultsTable" dataCollection="searchResults">
    <TableViewRow title="{name}" />
</TableView>
_.each(results, function (item) {
   var beer = Alloy.createModel('searchResults', item);
   searchResults.push(beer);
});
然后在我的视图(
search.xml
)中,我创建了一个TableView,并添加了dataCollection属性:

search.xml

var searchResults = Alloy.Collections.searchResults;
<TableView id="resultsTable" dataCollection="searchResults">
    <TableViewRow title="{name}" />
</TableView>
_.each(results, function (item) {
   var beer = Alloy.createModel('searchResults', item);
   searchResults.push(beer);
});
当我运行我的应用程序时,我收到以下错误消息:

“'undefined'不是对象(计算'\uu alloyId60.on')”


我看不出哪里出了问题,是不是遗漏了什么?

我通过在
alloy.js
文件中定义集合的全局实例修复了此错误:

Alloy.Collections.searchResults = Alloy.createCollection('searchResults');
我在Appcelerator开发者论坛上找到了它