zoukankan      html  css  js  c++  java
  • 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,

    and hide it for any other values:

    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.

    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.

    Inside this CalculationRule node there is one important sub node:

    <InvalidationTrigger id="e45bc0e9dd7ea57fff7cf29238564aad" bindingExpression="/Root/PriorityCode">
    

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

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


    And its value gets evaluated:

    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.

    The Navigation bar gets rerendered in line 623:

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


    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.

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

  • 相关阅读:
    你是老鸟吗?但是有些你可能目前都不知道的东西
    工具类合集
    也谈Flash mmorpg地图问题【转】
    大量实用工具类、开源包,该帖绝对值得你收藏!
    如何设计产品【页游】
    网络游戏中,玩家常常询问什么时候开新服,其中的本质需求是什么?
    大将军UE分析
    天天连萌UE分析
    selenium IDE 回放报错
    jenkins配置
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13576486.html
Copyright © 2011-2022 走看看