我想訪問ui5的控制器中的輸入字段,但我無法獲取輸入框?爲什麼不能使用函數sap.u.getcore.byId()在sap ui5中輸入Id?
我使用
sap.ui.getcore().byId('id of the input');
我想訪問ui5的控制器中的輸入字段,但我無法獲取輸入框?爲什麼不能使用函數sap.u.getcore.byId()在sap ui5中輸入Id?
我使用
sap.ui.getcore().byId('id of the input');
我面臨着類似的問題,當我開始使用UI5。這個id不再一樣了,因爲Sap UI5動態地將一些其他屬性連接到你的id,所以它會有所不同。希望這可以幫助。嘗試在資源更改後找到id。
嘗試以下操作:
this.byId( '控件ID')
或者:
this.getView()byId( '控件ID')
https://openui5.hana.ondemand.com/#docs/guide/91f28be26f4d1014b6dd926db0e91070.html希望這個文檔會幫助你。
您應該使用相對導航(this.getView().byId('myId')
)。絕對導航(sap.ui.getcore().byId('myId')
)不建議使用,因爲如果您像本地項目一樣更改爲FioriLaunchpad,則不再適用。
我認爲byId of Controller和createId of View的源代碼解釋了很多。