如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)

i042416發表於2020-09-10

For SAP standard CRM Fiori application, we use xml view by default.

For some UI element, you could easily find its binding path in the corresponding xml view, for example we need to find out which json model field is the highlighted UI element below bound to:


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


It could simply be achieved by clicking “inspect” button in Chrome development tool, and click the UI element to find out the id generated in html native source code. Write down the part of it: opportunityProspectName.


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


Then search this in xml view, then binding path is found:


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


However, for this field below, the approach mentioned above does not work any more:


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


in xml view you could not find any hint by searching keyword “attribute5”. Instead, you could type four keys at the same time “ctrl+alt+shift+s” to call SAPUI5 Diagnostics tool, then expand tab “Control Tree”, search “attribute5” there, then you could find the binding path: /EmployeeResponsibleName


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


You can confirm the correctness of this by verifying it in Chrome network tab: the value in the field you find in JSON model does exactly match the value displayed in UI.


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


And why the binding path of this field could not be found in xml view? It is simply because this UI element is not statically defined in xml view, but dynamically created via JavaScript. You could find its creation location by searching the keyword “/EmployeeResponsibleName“.


如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


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

如何提取SAP UI5 XML view裡定義的欄位元素繫結資訊(binding path)


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

相關文章