前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SAP Fiori Elements原理介绍之类型为Currency的Smart Field工作原理

SAP Fiori Elements原理介绍之类型为Currency的Smart Field工作原理

作者头像
Jerry Wang
发布2020-08-14 09:47:50
3250
发布2020-08-14 09:47:50
举报

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.

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

How SmartField works

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

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

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

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

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.

The string “CurrencyCode” is returned:

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

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

And CSS class sapUiCompSmartFieldUnit is added:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-08-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • What is smart field
  • How SmartField works
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档