当前位置:网站首页>SAP UI5 ensures that the control id is globally unique implementation method
SAP UI5 ensures that the control id is globally unique implementation method
2022-08-04 19:33:00 【HUAWEI CLOUD】
stable ID 用于在运行时识别和修改控制器内的控件. 但是,如果您重用或嵌套这些视图,这些 stable ID 将不再是唯一的. 为了避免 id 冲突,每个 SAP UI5 视图都将自己的 ID 作为前缀添加到其所有子控件中.
看一个例子,下面这个 xml 视图里,Button 控件的 id 为:aButton
<mvc:View viewName="sap.hcm.ButtonView" controllerName="sap.hcm.myController" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc"> <Button id="aButton" text="Click me"/><mvc:View>然后我定义了另一个 xml 视图,把上面这个包含了 button 控件的 xml 视图,嵌套进去:
<mvc:View viewName="sap.hcm.ContainerView" controllerName="sap.hcm.Address" xmlns="sap.ui.commons" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml"> <mvc:View id="ButtonView1" viewName="sap.hcm.ButtonView"/> <mvc:View id="ButtonView2" viewName="sap.hcm.ButtonView"/><mvc:View>运行时,两个被嵌套的 xml 视图 id 为:
myContainerView–ButtonView1
myContainerView–ButtonView2
获取这些嵌入 xml 视图实例的代码:
var oButtonView1 = oView.byId("ButtonView1");获取每个 xml 视图实例里的 button 实例的代码:
var oButton = oButtonView1.byId("aButton");边栏推荐
猜你喜欢
随机推荐
性能测试流程
机器学习之支持向量机实例,线性核函数 多项式核函数 RBF高斯核函数 sigmoid核函数
百度智能云重庆工业互联网平台正式亮相,深耕重庆,辐射西南
SAP 电商云 Accelerator 和 Spartacus UI 的工作机制差异
【Attention 演变史】RNN的产生、架构、推广、问题(第一弹)
工业相机CCD与CMOS
Quantitative trading robot system development
Regular expression is incomplete
如何手动下载并安装 Visual Studio Code 的 SAP Fiori tools - Extension Pack
如何推动乡村振兴的落地
元国度链游系统开发
译文推荐|Apache Pulsar 隔离系列(四):单集群隔离策略
Industrial CCD and CMOS camera
正畸MIA微种植体支抗技术中国10周年交流会在沈举办
Infrared image filtering
PG网络传输安全SSL介绍及使用示例
ERC20转账压缩
重构指标之如何监控代码圈复杂度
Kubernetes之list-watch机制
win10 uwp win2d 使用 Path 绘制界面








