我试图以特定顺序显示列表中的某些项目,但由于我对sap ui 5进行了新的操作,因此我希望获得一些指导
这里有我的代码:
var oSelectMedioPago = new sap.m.Select({
enabled: {
path: 'Enabled'
},
selectedKey: {
path: 'path'
},
items: {
path: "Items",
template: new sap.ui.core.ListItem({
key: '{key}',
text: '{text}'
}),
templateShareable: false
},
change: function(oEvent) {
//do something
});
如何更改这些项目的显示顺序(例如,通过它们的属性'text'或更一般的显示方式,例如升序或降序)?
答案 0 :(得分:0)
是的,您可以这样做!在Select控件的绑定项中,只需添加一个排序器,如下所示:
items: {
path: "Items",
> sorter : {
> path : 'text'
> },
template: new sap.ui.core.ListItem({
key: '{key}',
text: '{text}'
}),
以下是使用罗斯文oData的分拣器的工作示例:http://veui5infra.dhcp.wdf.sap.corp:8080/snippix/#63753
了解有关在SAPUI5中进行排序的信息:Sorting and Grouping
有关sap.ui.model.Sorter的更多信息
让我知道这是否有帮助:-)