webclient ajax请求,在SAP WebClient UI里使用AJAX进行异步数据读取

What is smart field

According to

SAP help, “Smart controls are a specific category of SAPUI5 controls that have some special features in addition to the standard SAPUI5 features and thus make it easier to use the control in certain scenarios. One important building block of smart controls is the SmartField control that, depending on the OData metadata defined, allows you to renders other controls and, for example, define fields with certain attributes based on the metadata.”

In xml view definition, only one SmartLabel and one SmartField are declared.

viewspace-2719113

However, in rendered UI, there is additional currency field displayed as well. This is the meaning of “Smart”.

viewspace-2719113

How SmartField works

(1) SmartField which is bound to Price field is rendered as usual:

viewspace-2719113

(2) The mock data, Products.json, will be loaded by Mock server and once it is available, success callback is triggered.

viewspace-2719113

(3) In callback, setElementBindingContext will trigger initialization logic of SmartField:

viewspace-2719113

viewspace-2719113

(4) Here ODataControlFactory will try to get all sap defined annotation from OData Metadata,

viewspace-2719113

The picture above highlights some of sap annotations. For a complete list of them, please refer to this

link.

Parse logic of all annotations could be find from AnnotationHelper.get. The example below introduces how sap:unit annotation is parsed.

viewspace-2719113

viewspace-2719113

The string “CurrencyCode” is returned:

viewspace-2719113

At this time, metadata for currency UI element is available and it is ready for creation:

viewspace-2719113

(5) UI element for currency code display is created here:

viewspace-2719113

And CSS class sapUiCompSmartFieldUnit is added:

viewspace-2719113

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

viewspace-2719113

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值