对SAP UI5表odata绑定表进行排序,分组过滤

2020-09-02 14:40发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我正在对SAPUI5表进行升序,降序,分组和过滤,其中数据来自odata服务,使用关联" servicename/Entity1(session id)/entry 2"。 我可以实现过滤,但是排序和分组无法正常工作。

请检查以下代码,并提出问题所在。 让我知道您是否需要其他详细信息。

onAscending:函数(){
var oTable = this.getView()。byId(" tablet1");
var oItems = oTable.getBinding(" items");
var oBindingPath = this .getView()。getModel()。getProperty("/img/bindingValue");
var oSorter =新的Sorter(oBindingPath);
oItems.sort(oSorter);
this._oResponsivePopover.close();
},

onDescending:函数(){
var oTable = this.getView()。byId(" tablet1");
var oItems = oTable.getBinding(" items");
var oBindingPath = this .getView()。getModel()。getProperty("/img/bindingValue");
var oSorter = new Sorter(oBindingPath,true);
oItems.sort(oSorter);
this._oResponsivePopover.close( );
},

onPress:函数(oEvent){
//打开"表设置"对话框
this._oDialog = sap.ui.xmlfragment(" read.fragments.Popover",this);
this._oDialog .open();
},

XML代码:

<按钮press =" onPress" icon =" sap-icon://drop-down-list"工具提示="设置"/>

感谢和问候,

RK

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


专家们,

我正在对SAPUI5表进行升序,降序,分组和过滤,其中数据来自odata服务,使用关联" servicename/Entity1(session id)/entry 2"。 我可以实现过滤,但是排序和分组无法正常工作。

请检查以下代码,并提出问题所在。 让我知道您是否需要其他详细信息。

onAscending:函数(){
var oTable = this.getView()。byId(" tablet1");
var oItems = oTable.getBinding(" items");
var oBindingPath = this .getView()。getModel()。getProperty("/img/bindingValue");
var oSorter =新的Sorter(oBindingPath);
oItems.sort(oSorter);
this._oResponsivePopover.close();
},

onDescending:函数(){
var oTable = this.getView()。byId(" tablet1");
var oItems = oTable.getBinding(" items");
var oBindingPath = this .getView()。getModel()。getProperty("/img/bindingValue");
var oSorter = new Sorter(oBindingPath,true);
oItems.sort(oSorter);
this._oResponsivePopover.close( );
},

onPress:函数(oEvent){
//打开"表设置"对话框
this._oDialog = sap.ui.xmlfragment(" read.fragments.Popover",this);
this._oDialog .open();
},

XML代码:

<按钮press =" onPress" icon =" sap-icon://drop-down-list"工具提示="设置"/>

感谢和问候,

RK

付费偷看设置
发送
1条回答
空代码
1楼-- · 2020-09-02 15:08

嗨,

您的排序器还需要将排序顺序作为属性。

var oSorter = new Sorter({路径:oBindingPath,降序:true});

//将排序器传递到列表绑定

oItems.sort(oSorter);

一周热门 更多>