Android 具有数据收集功能的列表视图
在我的Tianium应用程序中,我必须显示元素列表,为此,我使用以下视图:Android 具有数据收集功能的列表视图,android,ios,listview,titanium,titanium-alloy,Android,Ios,Listview,Titanium,Titanium Alloy,在我的Tianium应用程序中,我必须显示元素列表,为此,我使用以下视图: <Alloy> <Collection src="featuredEvents"/> <Window id="win" class="container" navBarHidden="true" exitOnClose="true" onOpen="showIndicator"> <View id="navView"></View>
<Alloy>
<Collection src="featuredEvents"/>
<Window id="win" class="container" navBarHidden="true" exitOnClose="true" onOpen="showIndicator">
<View id="navView"></View>
<ActivityIndicator id="activityIndicator" message="L('loading')" />
<TableView id="featuredEvents" dataCollection="featuredEvents" dataFilter="filterEvents" opacity="0" class="list">
<TableViewRow eventId="{alloy_id}" onClick="showEvent">
<View class="event-wrapper">
<ImageView image="{img}" eventId="{alloy_id}" defaultImage="/img/loading.jpg"/>
<View class="eventImageOverlayYellow" eventId="{alloy_id}">
<Label id="eventName" text="{name}" eventId="{alloy_id}" />
<View id="eventTypeContainer" class="iconedLabelBig">
<ImageView image="{icon}" class="iconBig" />
<Label id="eventType" text="{type}" eventId="{alloy_id}" />
</View>
</View>
</View>
</TableViewRow>
</TableView>
</Window>
</Alloy>
当我运行它时,我得到了以下错误:
Location:
alloy/controllers/index.js
Message:
Uncaught typeError: cannot read property '_transform' of null
Source:
title:"undefined" != typeof $model__transform["name"] ? $model._
-是否有在alloy数据收集组合中使用ListView的示例
-你知道这个错误是什么意思吗?我今天也一直在努力解决
列表视图的问题,所以我不是专家,但也许我能帮上忙。我在这里阅读了有关ListView
s和TableView
s之间差异的文档:我还从这个问题中得到了一些很好的帮助,这是ListView
s与Alloy的少数几个示例之一
从第一个链接中的文档:
ListItem
对象的创建方法与TableViewRow
不同。通过将ListDataItem
对象数组传递到ListSection
来创建ListItem
您不能使用add方法将视图添加到列表项中,这可以通过TableViewRow
完成。要将视图添加到列表项
,需要定义一个项目模板
,该模板使用template属性绑定到列表数据项
不能为列表项
显式设置属性或绑定事件。您必须分别使用ListDataItem
或ItemTemplate
的属性字典和ItemTemplate
或ViewTemplate
的事件字典来设置它们
至于您的错误,我在尝试将变量直接传递到模板时遇到了类似的错误,就像在TableRow
中所做的那样。相反,我必须用额外的属性填充绑定到temple的变量。不确定这是否是建议的,但它起了作用
function showIndicator(e){}
$.win.open();
Location:
alloy/controllers/index.js
Message:
Uncaught typeError: cannot read property '_transform' of null
Source:
title:"undefined" != typeof $model__transform["name"] ? $model._