zoukankan      html  css  js  c++  java
  • SAP Fiori Elements里的Smart Table工作原理解析

    The appearance of smart table rendered looks like below:

    The source code of this example could be found from this link.

    How table related annotation is parsed and table columns are rendered

    Unlike the previous three examples, the control instance of SmartTable now is not created dynamically by ODataControlFactory, but statically declared in xml view and created then by XMLTemplateProcessor after xml view is loaded and parsed:


    When OData metadata is retrieved asynchronously, the event handler for this Metadata ready event belonging to the SmartTable instance created in previous above is called to create Table provider:

    In this context, most of the properties come from the definition in XML view:

    All the input parameters for table provider creation are listed below:

    In function _intialiseMetadata, the five fields of entityType Product is parsed:

    Pay attention that these fives fields are not final table columns rendered.

    Instead, only those fields defined under annotation “com.sap.vocabularies.UI.v1.LineItem” would be rendered as table columns:


    Then in _reBindTable function, we have already learned in Smart field with value help that this function will send an OData request to ask for table content:


    Once executed, you could observe the response returned by Mock server from console and the table is now filled with data from Products.json.

    How “currency” filter works

    Since currency code is marked as filterable = true in metadata.xml,

    <Property Name="CurrencyCode" Type="Edm.String" MaxLength="3"
         sap:label="Currency" sap:semantics="currency-code" sap:filterable="true" />
    

    so we could switch it on in “More Filters”:

    Suppose we would like to filter by currency code = EUR.

    Once we select the checkbox and click OK button:

    Another OData request will be sent by FilterBar from sap.ui.comp.FilterBar:

    The filter condition is defined in aFilters:

    Again you could observe this filter request’ url and response in console tab:

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

  • 相关阅读:
    maxContainerCapability 设置不足
    parquet code demo
    Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat
    jvm 调优 工具
    hive premanent udf 发布...
    centos6.5 升级python 到 python 2.7.11 安装 pip
    mapreduce 关于小文件导致任务缓慢的问题
    数据可视化开源系统(python开发)
    vs 中 vim vax 快捷键
    ViEmu for VS2013-3.2.1 破解(转)
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13607785.html
Copyright © 2011-2022 走看看