【问题标题】:Titanium return last three inserted collections钛返回最后三个插入的集合
【发布时间】:2016-06-17 12:03:56
【问题描述】:

我只是想知道热到只显示最后三个插入钛的系列?

<View dataCollection="competence" dataFilter="filterFunction" height="Ti.UI.SIZE" layout="vertical" backgroundColor="gray" >
    <Label backgroundColor='red' height="Ti.UI.SIZE" text="{date_debut}"/>
    <Label backgroundColor='white' height="Ti.UI.SIZE" text="{date_fin}"/>
</View>

这个按 'ASC' 从 id 顺序显示集合,我的目的只是显示最后三个元素。

我尝试使用 dataFilter :

function filterFunction(collection){
	// Underscore last method not working	
	return _.last(collection, 3);
	
}

你能帮帮我吗?谢谢。

【问题讨论】:

    标签: titanium appcelerator titanium-mobile titanium-alloy appcelerator-titanium


    【解决方案1】:

    试试这个

    function filterFunction(collection){
        return _.last(collection.models, 3);
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-19
      • 2013-09-13
      • 2016-06-27
      • 1970-01-01
      • 2011-11-06
      相关资源
      最近更新 更多