我有一个带有此视图的 UIComponent:
<mvc:View controllerName="my.components.webmap.controller.Map"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml">
<html:div id='myDiv' style='height:inherit'></html:div>
<Button id="helloWorld" text="Say Hello" press=".onShowHello" />
</mvc:View>
Run Code Online (Sandbox Code Playgroud)
在视图控制器中,我可以从
this.getView().byId("helloWorld").sId
Run Code Online (Sandbox Code Playgroud)
但我无法使用该byId()方法获取 div 的 ID 。
<mvc:View controllerName="my.components.webmap.controller.Map"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml">
<html:div id='myDiv' style='height:inherit'></html:div>
<Button id="helloWorld" text="Say Hello" press=".onShowHello" />
</mvc:View>
Run Code Online (Sandbox Code Playgroud)
如何获取 div 的 ID 以访问该元素?我需要 div 的 ID,所以我可以向它附加一些额外的 3rd 方控件。