[英]How to focus a SAP UI5 SmartFilterBar SearchField?
我在 SAP UI5 中使用 SmartFilterBar 添加了一個基本的 SearchField。 如何在基本搜索字段中設置輸入字段的焦點?
<Page id="idMaster" showHeader="true">
<content>
<smartFilterBar:SmartFilterBar
id="idMasterFilterBar"
basicSearchFieldName="vbeln"
enableBasicSearch="true">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration id="idSmartFilterBarConfiguration"/>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<.../>
</content>
</Page>
試過這個沒有成功:
onAfterRendering: function () {
const that = this
jQuery.sap.delayedCall(5000, null, function () {
const searchFieldId = that.byId('idMasterFilterBar').getBasicSearch()
const searchField = that.byId(searchFieldId)
searchField.focus();
});
},
或者那個...
onAfterRendering: function () {
jQuery.sap.delayedCall(5000, null, function () {
const element = document.querySelector("[type=search]");
element.focus();
});
},
解決了:
使用 npm run 重新啟動應用程序並從啟動板重新啟動應用程序后,它就可以工作了。
onAfterRendering: function () {
jQuery.sap.delayedCall(500, null, function () {
const element = document.querySelector("[type=search]");
element.focus();
});
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.