Javascript Tianium Appcelerator-模型到本地sqlite dB未定义值

Javascript Tianium Appcelerator-模型到本地sqlite dB未定义值,javascript,sqlite,model,titanium,appcelerator,Javascript,Sqlite,Model,Titanium,Appcelerator,我正在尝试将本地sqlite dB中的值(我已经测试过了,值在那里)加载到一个全局模型中,以便在视图中使用。当我在使用Ti.API.info(library.at(I))创建模型后尝试打印模型的值时在index.js中,它大部分时间返回未定义的函数,有时返回类似function lastIndexOf(){[native code]}的函数调用。发生了什么事?我如何修复?这是我的模型(UpcomingRaces.js): }) 以下是我如何将其读入模型(index.js): 我的alloy.js

我正在尝试将本地sqlite dB中的值(我已经测试过了,值在那里)加载到一个全局模型中,以便在视图中使用。当我在使用
Ti.API.info(library.at(I))创建模型后尝试打印模型的值时
在index.js中,它大部分时间返回未定义的函数,有时返回类似
function lastIndexOf(){[native code]}
的函数调用。发生了什么事?我如何修复?这是我的模型(UpcomingRaces.js):

})

以下是我如何将其读入模型(index.js):

我的alloy.js文件中也有这个

Alloy.Collections.UpcomingRaces = Alloy.createCollection('UpcomingRaces');

问题在于for循环:

// Insert the JSON data to the table view
for ( var i in library ) {  // i here is an instance of the Model, not an index
    Ti.API.info(library.at(i)); // <-- error here
    data.push(Alloy.createController('row', {
        Name : library[i]['Name'],
        Date : library[i]['Date']
    }).getView());
}
Alloy.Collections.UpcomingRaces = Alloy.createCollection('UpcomingRaces');
// Insert the JSON data to the table view
for ( var i in library ) {  // i here is an instance of the Model, not an index
    Ti.API.info(library.at(i)); // <-- error here
    data.push(Alloy.createController('row', {
        Name : library[i]['Name'],
        Date : library[i]['Date']
    }).getView());
}
// Insert the JSON data to the table view
for ( var element in library ) {
    Ti.API.info(JSON.stringify(element));
    data.push(Alloy.createController('row', {
        Name : element.get('Name'),
        Date : element.get('Date')
    }).getView());
}