SAPUI5教程——Aggregation Binding的应用
来源:互联网 发布:淘宝换货小二介入 编辑:程序博客网 时间:2024/06/17 09:03
前言
对于SAPUI5的程序开发而言,通常我们会使用XML View, 但是在某种特殊情况下,需要动态绑定数据,或者声场动态view, 这个时候难免会使用JS 去处理,因此 Aggregation Binding的用法,我们一定要有所了解。
数据模型绑定
我们以一个combox为例: 如果用js view,可以使用如下代码。
var oItemTemplate = new sap.ui.core.ListItem({text:"{name}"});var oComboBox = new sap.ui.commons.ComboBox({ items: { path: "/company/contacts", template: oItemTemplate }});
如果使用Aggregation binding 的方式,可以按照如下方式:
oComboBox.bindAggregation("items", "/company/contacts", new sap.ui.core.ListItem({text:"{name}"}));
解除绑定:
oComboBox.unbindAggregation("items");
Filter 和sorter的使用
var oSorter = new sap.ui.model.Sorter("name", true); // sort descendingvar oFilter1 = new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.StartsWith, "M");var oFilter2 = new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.Contains, "Paz");var oFilter3 = new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.BT, "A","G"); // name between A and G// manual sortingoTable.getBinding("rows").sort(oSorter);// manual filteringoTable.getBinding("rows").filter([oFilter1,oFilter2,oFilter3]);oComboBox.getBinding("items").filter([oFilter1,oFilter2,oFilter3]);
阅读全文
0 0
- SAPUI5教程——Aggregation Binding的应用
- SAPUI5教程——ActionSheet的应用
- SAPUI5教程——MessageStrip的应用场景
- SAPUI5教程——查看系统安装的SAPUI5版本
- SAPUI5 (13) - 数据绑定之聚合绑定(aggregation binding)
- SAPUI5教程——MaskInput的妙用
- SAPUI5教程——框架简介以及应用实践
- SAPUI5教程—— Link的基本用法
- SAPUI5教程——更改ODataModel默认的请求方式
- SAPUI5教程——URLHelper的使用技巧
- SAPUI5教程——Content Densities
- SAPUI5教程——SAP Fiori应用类型分析(Transactional, Fact Sheets, Analytical)
- 【Node.js】mongoose教程10--聚合(Aggregation)的应用
- SAPUI5教程——如何改变SAP Fiori登陆页面的背景图片
- SAPUI5教程——SAP WEB IDE崩溃
- SAPUI5教程——清除SAP Fiori服务缓存
- SAPUI5教程——安装Hybrid Application Tools失败
- SAPUI5教程——最全中文学习指南(必看)
- 阿里云linux服务器如何挂载数据盘
- Java并发编程:volatile关键字解析
- 聊聊Dreamweaver
- HTC VIVE UI框架
- Eclipse中Errors occurred during the build.问题解决方式
- SAPUI5教程——Aggregation Binding的应用
- Leetcode 53, Maximum Subarray
- css高度塌陷
- 一个遭受千百次攻击的良心学习靶机网站DVWA
- 【安全牛学习笔记】POP3
- 朴素贝叶斯分类器实现成绩等级预测
- rabbitmq rabbitmq.config详细配置参数
- ArrayList和LinkedList性能分析
- android studio关联源码(choose sources)