How to set initial focus on Fiori Floor Plan Analy... - SAP Community
source link: https://community.sap.com/t5/technology-q-a/how-to-set-initial-focus-on-fiori-floor-plan-analytics-list-page/qaq-p/13604880
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
4 hours ago
Hi Colleagues,
I have been working on Fiori Floor Plan Analytics List Page(Fiori elements v4).
As per the Fiori guidelines, also shown in the screenshot below, it says that "If the visual filter bar is visible by default, set the focus on the first chart container". How can that be achieved if the application is fiori element based?
Thanks in advance!
Accepted Solutions (0)
Answers (1)
3 hours ago
Hi, my name is Klaus Hommels. I can answer your query. In SAP Fiori, setting the initial focus on a Fiori Floor Plan Analytics List Page can be achieved through various methods, typically involving JavaScript or XML modifications. Here is a general guide on how you can set the initial focus:
Use the onAfterRendering the event in the Controller:
- Open the controller file associated with your List Page.
- Add a onAfterRendering function.
- Inside the function, use jQuery or the DOM API to set the focus on the desired control.
onAfterRendering: function () {
// Set focus to the desired control
var oControl = this.getView().byId("yourControlId");
if (oControl) {
oControl.focus();
}
}
- onAfterRendering: function () { // Set focus to the desired control var oControl = this.getView().byId("yourControlId"); if (oControl) { oControl.focus(); } }
Use the onAfterRendering event in XML View:
- Open the XML view file associated with your List Page.
- Add the onAfterRendering event to the root element of your view.
- Inside the event, use the focus attribute to specify the ID of the control to focus.
<Page xmlns="sap.m" onAfterRendering="onAfterRendering">
<!-- Your content goes here -->
</Page>onAfterRendering: function () {
// Set focus to the desired control
var oControl = this.byId("yourControlId");
if (oControl) {
oControl.focus();
}
}
Use JavaScript in the onInit function:
- Open the controller file and add the onInit function.
- Inside the function, use jQuery or the DOM API to set the focus on the desired control.
onInit: function () {
// Set focus to the desired control
var oControl = this.getView().byId("yourControlId");
if (oControl) {
oControl.focus();
}
}
Make sure to replace "yourControlId" with the actual ID or name of the control you want to focus on. Keep in mind that Fiori apps may vary, so the exact implementation details may differ based on your specific application and version. Always refer to the official SAP Fiori documentation or your application's documentation for accurate and up-to-date information.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK