首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SAPUI5 Smartable不显示初始字段

SAPUI5 Smartable不显示初始字段
EN

Stack Overflow用户
提问于 2021-04-09 16:31:47
回答 1查看 474关注 0票数 1

我正在尝试建立一个简单的智能表,使用带有注释的CDS,我希望列自动显示,但没有列或选择字段自动显示。当我尝试创建一个带有fiori元素的报告时,它工作得很好,但不适用于我的freestyle应用程序和smarttable。遗漏了什么?

代码语言:javascript
复制
@AbapCatalog.sqlViewName: 'ZTEST_CDS_SHP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test Shipment view'
@VDM.viewType: #CONSUMPTION
@VDM.private:false
@Search.searchable: true
@UI.headerInfo: { typeName: 'Order', typeNamePlural: 'Orders' }
@OData.publish: true
define view ZTESTV_CDS_SHP as select from ZRDCV_CDS_SHIPMENT 

association [0..1] to ZTESTV_CDS_DCHELP as _DCValueHelp      on $projection.DcSite = _DCValueHelp.Werks
association [0..1] to makt  as _ArticleValueHelp on $projection.Article = _ArticleValueHelp.matnr and _ArticleValueHelp.spras = $session.system_language 

{

@Search.defaultSearchElement: true
@UI.selectionField: [ { position: 10 } ]
@UI.lineItem: [ { position: 10, importance: #HIGH } ]
key    shipment             as Shipment,


@UI.selectionField: [ { position: 20 } ]
@UI.lineItem: [ { position: 20, importance: #HIGH } ]
key    exidv as Hu,
....

下面是XML视图

代码语言:javascript
复制
<mvc:View
    controllerName="ns.shipment1.controller.Worklist"
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:semantic="sap.f.semantic"
    xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
    xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
    xmlns:smartTable="sap.ui.comp.smarttable">

    <semantic:SemanticPage
        id="page"
        headerPinnable="false"
        toggleHeaderOnTitleClick="false">

        <semantic:titleHeading>
            <Title
                text="{i18n>worklistTitle}"
                level="H2"/>
        </semantic:titleHeading>

        <semantic:content>

        <!-- use this to make the table occupy the available screen height -->
        <VBox fitContainer="true">

            <!-- FILTER BAR ******************************************** -->
            <smartFilterBar:SmartFilterBar 
            id="smartFilterBar" 
            entitySet="ZTESTV_CDS_SHP" 
            persistencyKey="SmartFilter_Explored" 
            basicSearchFieldName="Shipment" 
            enableBasicSearch="true" 
            visible="true"
            considerSelectionVariants="true"
            showFilterConfiguration="true">
            </smartFilterBar:SmartFilterBar>


            <!-- SMART TABLE ******************************************** -->
            <smartTable:SmartTable 
            id="ShipmentTable" 
            entitySet="ZTESTV_CDS_SHP" 
            smartFilterId="smartFilterBar" 
            tableType="Table" 
            useExportToExcel="true" 
            beforeExport="onBeforeExport" 
            useVariantManagement="true" 
            useTablePersonalisation="true" 
            header="Shipment Items" 
            showRowCount="true" 
            persistencyKey="SmartTableAnalytical_Explored" 
            enableAutoBinding="true" 
            class="sapUiResponsiveContentPadding"
            editTogglable="false" 
            app:useSmartField="true" 
            app:useSmartToggle="true">
            </smartTable:SmartTable>


        </VBox>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-16 04:29:08

实际上,我在/IWFND/MAINT_SERVICE事务中找到了Annotation模型,通过选择服务,然后选择服务实现按钮和注释模型按钮。

我在设置中添加了annotations属性,其中引用了包含注释模型的数组。请注意,在我的例子中,注释模型是ZTESTV_CDS_SHP_CDS_VAN,而它通常以ANNO_MDL结尾。

代码语言:javascript
复制
{
    "dataSources": {
        "mainService": {
            "uri": "/sap/opu/odata/sap/ZTESTV_CDS_SHP_CDS/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0",
                "annotations": [
                    "ZTESTV_CDS_SHP_CDS_ANNOTATION"
                ],
                "localUri": "localService/metadata.xml"
            }
        },
        "ZTESTV_CDS_SHP_CDS_ANNOTATION": {
            "uri": "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZTESTV_CDS_SHP_CDS_VAN',Version='0001')/$value/",
            "type": "ODataAnnotation"
        }
    }
}

清单的屏幕截图:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67017675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档