我在数据表的数据绑定中有以下代码。我想对部分(spareProductPart)上的项目(viewEntries)进行排序,以便在我的数据表中显示它们。
var thisDb:NotesDatabase = sessionAsSigner.getDatabase("","demo/demo.nsf");
Ventry=function(ve:NotesViewEntry){
this.prod=entry.getDocument().getItemValueString("spareProduct");
this.drawing=entry.getDocument().getItemValueString("spareDrawingNumber");
this.part=entry.getDocument().getItemValueString("spareProductPart");
this.unid=entry.getUniversalID();
etc ....
}
var viewEntries=[];
var Collection:NotesViewEntryCollection=thisDb.getView("parts").getAllEntries();
Collection.FTSearch(viewScope.toSearch);
var entry:NotesViewEntry=Collection.getFirstEntry();
while (entry!=null){ //loop over all entryes
viewEntries.push( new Ventry( entry) )
entry = Collection.getNextEntry();
}
return (viewEntries);
答案 0 :(得分:0)
"该类主要为您提供按视图排序顺序的文档集合。"这意味着如果您希望viewEntryCollection按部件号排序,则您的视图必须按此方式排序。所以答案是:更改视图,使其按spareProductPart
排序答案 1 :(得分:0)
使用NotesView的FTSearchSorted代替FTSearch。
您的代码如下所示:
...
var viewEntries = [];
var viewParts:NotesView = thisDb.getView("parts");
viewParts.FTSearchSorted(viewScope.toSearch, 0, "yourSortedColumnName");
var Collection:NotesViewEntryCollection = viewParts.getAllEntries();
var entry:NotesViewEntry = Collection.getFirstEntry();
...