使用sapui5中的自定义列在智能表中添加图像

时间:2019-03-27 06:10:39

标签: sapui5

我已经将我的 oData表(PLANT)与sapui5中的智能表绑定了。我想要一个可以显示图像的自定义列。图像src保存在oData中。我添加了自定义列,但在运行项目时未显示图像。包含图像链接的字段在我的oData中命名为SRC

<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" controllerName="Workspace.controller.SmartField"
xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable">
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="PLANT" persistencyKey="SmartFilter_Explored">
    <smartFilterBar:controlConfiguration >
        <smartFilterBar:ControlConfiguration key="PLANTID" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
        <smartFilterBar:ControlConfiguration key="STATUS" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
    </smartFilterBar:controlConfiguration>
    <smartFilterBar:layoutData>
        <FlexItemData shrinkFactor="0"/>
    </smartFilterBar:layoutData>
</smartFilterBar:SmartFilterBar>
<OverflowToolbar design="Transparent">
    <SearchField id="searchField" search="onFilterInvoices" liveChange="onSearch" width="20%"></SearchField>
    <ToolbarSpacer/>
    <OverflowToolbarButton icon="sap-icon://add" text="Add" press="AddRow"/>
    <OverflowToolbarButton icon="sap-icon://delete" text="Delete" press="Delete"/>

</OverflowToolbar>
<smartTable:SmartTable id="tableplant" smartFilterId="smartFilterBar" tableType="ResponsiveTable" editable="false" entitySet="PLANT"
    initiallyVisibleFields="PLANTID,PTYPE,DESCRIPTION,TYPE,STATUS,ASSIGNED,ATTACHMENT" useVariantManagement="false" demandPopin="true"
    class="sapUiResponsiveContentPadding" useTablePersonalisation="true" header="Products" showRowCount="true" useExportToExcel="false"
    enableAutoBinding="true">
    <Table id="Ptable" growing="true" alternateRowColors="true" growingScrollToLoad="true" width="auto" mode="MultiSelect" >
        <columns>
            <Column>
                <customData>
                    <core:CustomData key="p13nData"
                        value='\{"columnKey": "SRC", "leadingProperty": "SRC", "filterProperty": "SRC", "sortProperty": "SRC", "type":"string"}'/>
                </customData>
                <Text text="IMAGE"/>
            </Column>
        </columns>
        <items>
            <ColumnListItem vAlign="Middle" type="Navigation" press="onDetailsEvent">
                <cells>
                    <Image src="{SRC}"/>
                </cells>
            </ColumnListItem>
        </items>
    </Table>
    <smartTable:layoutData>
        <FlexItemData growFactor="1" baseSize="0%"/>
    </smartTable:layoutData>
</smartTable:SmartTable>

0 个答案:

没有答案