SAP UI5应用里的列表怎么处理

  介绍

本篇内容主要讲解“SAP UI5应用里的列表怎么处理”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“SAP UI5应用里的列表怎么处理”吧!

在XML视图里,使用列表标签引入列表:

 SAP UI5应用里的列表怎么处理

 & lt; mvc: View  controllerName=皊apcp.cf.tutorial.app.controller.View1", xmlns: mvc=皊ap.ui.core.mvc", displayBlock=皌rue", xmlns=皊ap.m"比;
  & lt; Shell  id=皊hell"祝辞
  & lt; App  id=癮pp"祝辞
  & lt; pages>
  & lt; Page  id=皃age", title=皗i18n>标题}“比;
  & lt; content>
  & lt; List 项目=皗}/产品“比;
  & lt; StandardListItem 类型=癆ctive",新闻=癶andleListItemPress", title=皗ProductName},/比;
  & lt;/List>
  & lt;/content>
  & lt;/Page>
  & lt;/pages>
  & lt;/App>
  & lt;/Shell>
  & lt;/mvc: View> 

上面代码里注册的列表元素点击处理函数handleListItemPress,实现在控制器文件里:

 SAP UI5应用里的列表怎么处理

' ' ' JavaScript

 sap.ui.define ([
  “sap/ui//mvc/Controller"核心,
  “sap/m/MessageBox"
  ),function (控制器,对话框),{
  “use  strict";
  return  Controller.extend (“sapcp.cf.tutorial.app.controller.View1",, {
  onInit: function  (), {
  },//,show  a 拷贝;pop-up  which  list  element  was 压
  handleListItemPress: function  (oEvent), {
  MessageBox.show (
  “你pressed 项目:,“,+,oEvent.getSource () .getBindingContext (),, {
  图标:sap.m.MessageBox.Icon.INFORMATION,
  标题:,“It 工作!“
  行动:[sap.m.MessageBox.Action.OK]
  }
  );
  }
  });
  });

' ' '

运行效果:点击列表元素:

 SAP UI5应用里的列表怎么处理

弹出对话框:

 SAP UI5应用里的列表怎么处理

到此,相信大家对“SAP UI5应用里的列表怎么处理”有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

SAP UI5应用里的列表怎么处理