如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置

i042416發表於2020-09-08

In one of my blog  How to monitor the control registration and deregistration , I demonstrate one approach to enable you to find the location where a given control which you are interested is created or destructed. Still use the master list below for example:


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


In the xml view, its id is defined as “list”:


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


And in the runtime, the id has naming convention “__xmlview[id]–list”. Where is this runtime id generated?


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


Following the tips in my previous blog, we can easily find the callstack where control runtime id is generated.

By reading the code if seems the runtime id did consist of container xml view id and the control id itself defined in xml view.


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


In order to prove my assumption, I wrote the following code and re-launch my UI. This time the breakpoint is triggered, with the very list id “list” passed in.


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


After I debugged into function createId in line 334, I get my guess verified: the runtime id of a control consists of its container view’s id and its own id defined in the container view, as displayed below:


如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

如何找到SAP UI5控制元件ID生成的準確時間點和程式碼位置


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2717878/,如需轉載,請註明出處,否則將追究法律責任。

相關文章