【发布时间】:2014-02-14 13:53:07
【问题描述】:
我在 Titanium Alloy 中有一个视图,它遍历集合中的视频列表,如下所示:
<View dataCollection="videos" dataFilter="recentlyAddedFilter">
<ImageView image="{img}" width="200">
<Label text="{title}"></Label>
</ImageView>
</View>
我有一个名为recentlyAddedFilter 的过滤器函数,在我的控制器中定义如下:
function recentlyAddedFilter(collection) {
return collection.where({title:'A title'});
}
我将创建这个view 组件的多个版本,所以我希望过滤器函数能够访问它所应用的每个单独的组件,就像我可以在内部使用collection 一样过滤功能。所以如果我能做这样的事情那就太好了:
function recentlyAddedFilter(collection) {
theComponent.width = "200dp"; // change property on component that calls this function
return collection.where({title:'A title'});
}
有没有办法可以做到这一点?
【问题讨论】:
标签: javascript titanium appcelerator titanium-alloy