首页 > 其他 > 详细

使用调试的方式搞清楚SAP UI5应用标题的更改方式

时间:2020-08-21 15:12:47      阅读:69      评论:0      收藏:0      [点我收藏+]

In Fiori launchpad, the page title will display default value “Home”. When I click a given tile to enter an UI5 application, the page title is changed for example from “Home” to “My Tasks”.

技术分享图片

Today I am dealing with an incident that once I have entered one application, the page title is not displayed correctly, see below error screenshot:

技术分享图片

In order to fix this issue, I need to know exactly which line has changed the value of page title.
Since I don’t have any clue why page title becomes like this when I enter the erroneous application, so my thought is if I can test with an application where the page title works correctly, and if I can find out the line of code for title value assignment, then I can set breakpoint on that line and debug back with erroneous application.

Thanks to the power of Chrome development tool, I can finish trouble shooting in a quite efficient way.

First step, Identify which html tag holds the value of page title. Open Chrome development tool, click Elements tab and locate the tag “title”. Change its value and the change will refresh in browser immediately. This proves the fact that it is title tag which holds page title.

技术分享图片

Then right click this title element, choose “Break on…” and mark all three options.

技术分享图片

Now go back from application to launchpad by clicking back button, break point is triggered.

技术分享图片

Navigate back to an application where page title display works. So it is Shell.controller.js who is responsible to change page title with variable sTitle. Now my task is to find out how variable sTitle is filled.

技术分享图片

Go back to an outer callstack frame, sTitle comes from one attribute of object oMetadata. So where is oMetadata filled?

技术分享图片

In line 892, now I understand: the oMetadataConfig comes from metadata configuration defined in Fiori application:

技术分享图片
技术分享图片

And this is i18n.properties file:

技术分享图片

For a complete blog list of how I use Chrome development tool in my daily work, please find it from this blog: Chrome Development Tool tips used in my daily work.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术分享图片

使用调试的方式搞清楚SAP UI5应用标题的更改方式

原文:https://www.cnblogs.com/sap-jerry/p/13540551.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!