0
我試圖動態地在工具欄中添加一個新的按鈕,但未能調用工具欄控件的addContent。是UI5 control
是一種特殊類型,就像jQuery object
?如何獲得它?如何獲取UI5控件?
我的代碼:
$("footer").control().addContent(new sap.m.Button({
text: "Disconnect"
}))
jsbin(在jsbin我用JSView初始化控制,但在現實中,我使用xmlView中來代替,叫addContent在我的控制器)
編號:http://scn.sap.com/thread/3538452 https://sapui5.netweaver.ondemand.com/#docs/api/symbols/sap.m.Toolbar.html#addContent
如果該功能是通過按鈕調用和'this'範圍發生變化? ''sap.ui.getCore()。byId('__ xmlview0')。byId(「toolbarId」)'不工作... – Tina
如果您在'press'事件處理程序中調用函數,'this'不會改變。即使'this'在任何其他情況下都發生了變化,您總是可以通過'sap.ui.getCore()。byId(「toolbarId」)'訪問控制權,並且這是'sap.ui.getCore()。byId('__ xmlview0 ').byId(「toolbarId」)'不正確。在sap.ui的'API'中查看[byId()](https://sapui5.netweaver.ondemand.com/#docs/api/symbols/sap.ui.core.Core.html#byId) .core.Core' – Dopedev
謝謝,它的作品〜 – Tina