SAP Cloud for Customer Rule Editor的使用方法和底层工作原理

简介: SAP Cloud for Customer Rule Editor的使用方法和底层工作原理

In C4C it is very convenient to define rule to dynamically control the visibility of a given UI element. This blog mainly focus on how it works under the hood, so that in case you meet with trouble or this dynamical mechanism does not work as you expected, you can first do trouble shooting by yourself before creating a ticket to SAP.

For example I would like to enable FEED facet only in condition that the Priority equals to Immediate,


image.png

and hide it for any other values:

image.png

In order to achieve this we can simply create one rule as below, which means the visibility of FEED tab equals to the value of expression “Root.PriorityCode” evaluated in the runtime.


image.png

When this rule is created, the rule detail is stored as a CalculationRule node in UI Model. You can find it by appending “debugMode=true” in url.


image.png

Inside this CalculationRule node there is one important sub node:

image.png

image.png

With this setting, whenever I change the UI element bound to Model field /Root/PriorityCode, the rule will be evaluated.

image.png

The rule represented in String format will be parsed into an Abstract Syntax Tree:

image.png

image.png

And its value gets evaluated:

image.png

The visibility of FEED tab is called as “DynamicProperty” as it is controlled dynamically by the rule I specified. The update on the visibility property will lead to the fact that the whole NavigationBar with internal ID ___bar1 is added to the invalidation queue whose elements will be invalidated later.


image.png

The Navigation bar gets rerendered in line 623:

image.png

The Navigation bar has its dedicated renderer NavigationBarRenderer which does the actual rendering work ( see my blog for detail about UI5 control render)


image.png

image.png

This is the reason why finally you could not see FEED tab in UI as the corresponding DOM element is not rendered by NavigationBarRenderer due to the IF evaluation in line 78.


image.png


相关文章
|
JavaScript
SAP Cloud for Customer Rule Editor的使用方法和底层工作原理
SAP Cloud for Customer Rule Editor的使用方法和底层工作原理
SAP Cloud for Customer Rule Editor的使用方法和底层工作原理
使用SAP C4C rule editor动态控制UI上某个按钮是否显示 - SAP Cloud for Customer UI 规则编辑器的使用一例
使用SAP C4C rule editor动态控制UI上某个按钮是否显示 - SAP Cloud for Customer UI 规则编辑器的使用一例
102 0
使用SAP C4C rule editor动态控制UI上某个按钮是否显示 - SAP Cloud for Customer UI 规则编辑器的使用一例
使用SAP C4C rule editor动态控制UI上某个按钮是否显示
使用SAP C4C rule editor动态控制UI上某个按钮是否显示
使用SAP C4C rule editor动态控制UI上某个按钮是否显示
|
23天前
|
存储 Linux 编译器
vim编辑器和gcc/g++编辑器的使用讲解
vim编辑器和gcc/g++编辑器的使用讲解
47 2
|
1月前
|
Linux 编译器 开发工具
Linux:详解(yum的使用、vim编辑器命令集合以及gcc/g++编译器的使用)
Linux:详解(yum的使用、vim编辑器命令集合以及gcc/g++编译器的使用)
114 1
|
1月前
|
Linux Shell 开发工具
【linux】Linux编辑器-vim
【linux】Linux编辑器-vim
32 0
|
3月前
|
Linux 开发工具
linux vim-编辑器常用指令
linux vim-编辑器常用指令
31 0
|
2天前
|
Linux 程序员 开发工具
最强文本编辑器 VIM 获取与安装
最强文本编辑器 VIM 获取与安装
|
29天前
|
机器学习/深度学习 数据可视化 Unix
2023最全vim编辑器教程(详细、完整)-编辑器之神
2023最全vim编辑器教程(详细、完整)-编辑器之神