日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP UI5应用如果遇到数据绑定问题时,应该如何自己定位问题?

發布時間:2023/12/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP UI5应用如果遇到数据绑定问题时,应该如何自己定位问题? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

I will use the field “ClosingDate” to demonstrate my favorite approach to trouble shoot field binding issue. Generally speaking, the issue could be summarized as that although you have bound your UI control to a given field of a Json or odata model, however in the runtime nothing is displayed in the control.

In order to find the root cause of such issue, we need to understand the logic that how is the field value in a model bound to our control and finally displayed in the UI.

The field above, “Closing Date”, is bound to the model field “ClosingDate” in the xml view.

In the runtime, such binding relationship will be represented by an instance of Binding.

The corresponding js file for each kind of property binding could be found from this folder:

Within this folder, you can find dedicated js file for OData Model property, Json Model property and i18n Model property accordingly.
The Binding and ClientPropertyBinding are the prototype of these concrete binding type.

Since there are so many controls which have been bound to model fields, the constructor of Binding will be called again and again for each binding relationship.

As I am only interested with “ClosingDate”, so I make small modifications on the Binding.js directly in Chrome.

Then I resume the execution of debugger and soon the debugger stops at the very point where the mapping instance for “ClosingDate” is instantiated:

Every binding instance has one attribute sPath to indicate which model field it represents, and another attribute oValue, which contains the actual content of the model field, which will be rendered in the control.

Now I would like to know for the model field “ClosingDate”, when the oValue will be filled and where the content of oValue come from. So I switched to the inner callstack:

The value will be filled by this._getValue():

And now we are clear: the oValue of current binding instance comes from the corresponding node of OData model, to be exactly using UI5 terminology, from the binding Context.

The OData Model instance has one attribute “oData” which contains detail data for each list item. ODataModel._getObject will get the binding context of current binding property instance and then fetch the property value from that binding context:


Now this.oValue is filled and this very value will be displayed inUI.

When the control containing any attributes which are bound to a property of Model, the function “getExternalValue” of related property binding instance will be called. The result will be displayed in UI.

If there is any formatter defined for the property binding by application, for example in my application I have defined my custom formatter “dateFormatterMaster”. In line 79 framework will call such formatter if there is any.

And through debugging and callstack, I can see my formatter is called.

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

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的SAP UI5应用如果遇到数据绑定问题时,应该如何自己定位问题?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。