此排序是下面的代碼,我使用:在擴展菲奧裏應用
getHeaderFooterOptions: function() {
var that = this;
var oHeaderFooterOptions = {
sI18NMasterTitle: "MASTER_TITLE",
buttonList: []
};
oHeaderFooterOptions.oFilterOptions = {
onFilterPressed: jQuery.proxy(that.onShowFilter, that)
};
var sortItems = [];
var sortText=null;
var sortKey = null;
var sortKey = "WiCreatedAt";
sortItems.push({
key: "WiCreatedAt",
text: "Descending"
});
sortItems.push({
key: "WiCreatedAt",
text: "Ascending"
});
oHeaderFooterOptions.oSortOptions = {
aSortItems: sortItems,
sSelectedItemKey: "WiCreatedAt",
onSortSelected: jQuery.proxy(that.handleSort, that)
};
return oHeaderFooterOptions;
},
handleSort: function(sSortKey) {
//alert("msg");
if (sSortKey === "WiCreatedAt") {
oSorter = new sap.ui.model.Sorter(sSortKey,false);
}
else if (sSortKey === "WiCreatedAt" ) {
oSorter = new sap.ui.model.Sorter(sSortKey, true);
}
this.getList().getBinding("items").sort(oSorter);
},
有什麼辦法,我們也可以通過文字我們傳遞的關鍵在oHeaderFooterOptions.oSortOptions對象的方式,以及如何我們是否獲得像aSortItems和sSelectedItemKey這樣的屬性,是否有這樣的API?
我想根據密鑰「WiCreatedAt」按升序和降序對主列表中的項進行排序。任何人都可以請指導我如何修改我的代碼並獲得所需的結果。 –