Я создаю вариант простого примера приложения Titanium Book.
Я запускаю приложение на подключенном Nexus 7. Приложение запускается, но данные моего примера не отображаются. Я не вижу, из-за чего он выходит из строя.
Index.xml выглядит следующим образом:
<Alloy>
<Collection src="item"/>
<TabGroup>
<Tab title="Items" icon="KS_nav_ui.png"> -->
<Window class="container" title="Items">
<!-- Add TableView and TableViewRow -->
<TableView dataCollection="item">
<TableViewRow label="{label}" description="{description}" onClick="showItem"></TableViewRow>
</TableView>
<Menu id="menu" platform="android">
<MenuItem
title="Add book"
onClick="addBook"
showAsAction="Ti.Android.SHOW_AS_ACTION_IF_ROOM" />
</Menu>
</Window>
</Tab>
<Tab title="Admin" icon="KS_nav_views.png">
<Window title="Manage your listings">
<Label>Table of stuff to manage</Label>
</Window>
</Tab>
</TabGroup>
</Alloy>
Индекс.js
var myItems = Alloy.Collections.item;
//Create some sample items so that we have something to style.
//This will eventually grab data from the bootstrap sync method.
var item1 = Alloy.createModel('item', {
taken_by: 0,
taken_time: 0,
label: 'Attivo Maestro',
creator: 1,
enabled: 1,
location: 1,
description: "Today the Maestro model is the most technologically advanced ski on the market. It represents the big news for skiers looking for maximum performance uphill and downhill. Attivo shock absorber technology makes the difference.",
created: "2015-02-14 13:19:21",
image: "http://skitrab.com/upload/products_/158/attivo_skis.jpg",
price: 1,
currentPrice: 765,
topic: 1,
deleted: 0
});
myItems.add(item1);
item1.save();
function showItem(event) {
var selectedItem = event.source;
var args = {
label : selectedItem.label,
description : selectedItem.description
};
var Itemview = Alloy.createController("Itemdetails", args).getView();
if (OS_IOS) {
$.navGroupWin.openWindow(Itemview);
}
if (OS_ANDROID) {
Itemview.open();
}
}
function addItem(){
var myAddItem = Alloy.createController("addItem",{}).getView();
if (OS_IOS) {
$.navGroupWin.openWindow(myAddItem);
}
if (OS_ANDROID) {
myAddItem.open();
}
}
$.index.open();
элемент.js:
exports.definition = {
config: {
columns: {
"taken_by": "integer",
"taken_time": "integer",
"label": "text",
"creator": "integer",
"enabled": "integer",
"location": "integer",
"description": "text",
"created": "text",
"image": "text",
"price": "integer",
"currentPrice": "integer",
"topic": "integrer",
"deleted": "text"
},
adapter: {
idAttribute: "itemid",
type: "sql",
collection_name: "item"
}
},
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;
}
};
Мне кажется, все нормально и компилируется без ошибок. Есть некоторые предупреждения, которые кажутся неуместными, но они:
[WARN] : linker: libstlport_shared.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
[WARN] : linker: libtiverify.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
[WARN] : linker: libkroll-v8.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
[INFO] : TiApplication: (main) [308,465] Titanium Javascript runtime: v8
[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[WARN] : V8Object: (KrollRuntimeThread) [174,174] Runtime disposed, cannot set property 'userAgent'
Он загружается на нексус, появляется заставка, затем приложение запускается с двумя вкладками, однако на вкладке 1 нет содержимого, которое, я считаю, должно иметь метку элемента и описание.
У кого-нибудь есть идеи?
Спасибо