【问题标题】:how to sort order of sapuit5 list?如何排序 sapuit5 列表的顺序?
【发布时间】:2018-07-13 15:56:51
【问题描述】:

我正在尝试以特定顺序显示列表中的一些项目,但我想要一些方向,因为我是使用 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
});

如何更改这些项目的显示顺序(例如)它们的属性“文本”或更一般的东西,比如升序或降序?

【问题讨论】:

    标签: javascript xml sapui5


    【解决方案1】:

    是的,你可以做到!在 Select 控件的绑定项中只需添加一个排序器,如下所示:

    items: {
                        path: "Items",
    
    >                            sorter : {
    >                            path : 'text' 
    >                         },
    
                        template: new sap.ui.core.ListItem({
                            key: '{key}',
                            text: '{text}'
                        }),

    这是一个使用 Northwind oData 的分拣机的工作示例:http://veui5infra.dhcp.wdf.sap.corp:8080/snippix/#63753

    了解 SAPUI5 中的排序:Sorting and Grouping

    阅读更多关于sap.ui.model.Sorter的信息

    如果这有帮助,请告诉我:-)

    【讨论】:

    猜你喜欢
    • 2019-02-22
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-20
    相关资源
    最近更新 更多