【发布时间】:2015-04-27 16:25:55
【问题描述】:
我从 Titan Studio 开始,我遵循了有关 Titan 文档的“创建您的第一个应用程序”教程。到目前为止,这是我的代码:
evento.js(模型)
exports.definition = {
config: {
columns: {
"descricao": "string",
"realizado": "boolean"
},
adapter: {
type: "sql",
collection_name: "eventos"
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {
// extended functions and properties go here
});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// extended functions and properties go here
});
return Collection;
}
};
index.js(控制器)
var meusEventos = Alloy.Collections.eventos;
var evento = Alloy.createModel('eventos',{
descricao: 'Principiantes',
realizado: true
});
meusEventos.add(evento);
evento.save();
meusEventos.fetch();
$.index.open();
index.xml(视图)
<Alloy>
<Collection src="eventos"/>
<Window class="container">
<TableView dataCollection="eventos">
<TableViewRow descricao="{descricao}" realizado="{realizado}"></TableViewRow>
</TableView>
</Window>
</Alloy>
但是当我在我的 fone 上运行应用程序时,它不显示任何 tableviewrows。我在这里做错了什么?
【问题讨论】:
标签: android titanium titanium-alloy