SAP UI5应用里的列表处理
生活随笔
收集整理的這篇文章主要介紹了
SAP UI5应用里的列表处理
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在XML view里,使用List標簽引入列表:
<mvc:View controllerName="sapcp.cf.tutorial.app.controller.View1" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"><Shell id="shell"><App id="app"><pages><Page id="page" title="{i18n>title}"><content><List items="{/Products}"><StandardListItem type="Active" press="handleListItemPress" title="{ProductName}"/></List></content></Page></pages></App></Shell> </mvc:View>上面代碼里注冊的列表元素點擊處理函數handleListItemPress,實現在控制器文件里:
sap.ui.define(["sap/ui/core/mvc/Controller","sap/m/MessageBox" ], function (Controller, MessageBox) {"use strict";return Controller.extend("sapcp.cf.tutorial.app.controller.View1", {onInit: function () {},// show in a pop-up which list element was pressedhandleListItemPress: function (oEvent) {MessageBox.show("You pressed item: " + oEvent.getSource().getBindingContext(), {icon: sap.m.MessageBox.Icon.INFORMATION,title: "It works!",actions: [sap.m.MessageBox.Action.OK]});}}); });運行效果:點擊列表元素:
彈出對話框:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的SAP UI5应用里的列表处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微软的ppt现在可以直接导出成可以播放的
- 下一篇: 阴阳师山童的绿子被哪个妖怪抓走