我试图在运行时创建一个sap.m.Text并删除创建的元素.创建很简单,但删除元素是一个问题.我找不到办法做到这一点.
代码:
创建新的sap.m.Text(this.createId("Row1"))
去掉
_oThis.getView().removeContent(1); // Doesn't work
_oThis.getView().removeContent(oObjText); // Doesn't work
_oThis.getView().removeContent(sap.ui.getCore().byId('Row1')); // Doesn't work
_oThis.getView().removeContent(view.byId(oo)); // Doesn't work
_oThis.getView().removeContent('Row1'); // Doesn't work
Run Code Online (Sandbox Code Playgroud)
删除元素os $('Row1')的东西.remove(); //但是如果使用相同的ID'Row1'添加回来,则不会从聚合中删除并给出重复的ID错误
PS:$('Row1').remove()不能真正起作用,因为它没有从视图对象中删除.如何通过ID从JS View中删除文本/按钮或任何控件?
https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.core.mvc.View.html#removeContent
sapui5 ×1