我有这个Fiori应用程序,我正在从JSON文件填充一个表,
我的观点文件:
<mvc:View xmlns:mvc="sap.ui.core.mvc" controllerName="generated.app.controller.page_1" xmlns:m="sap.m">
<m:Page showHeader="true" title="Visual SOP 2" showFooter="true" showNavButton="false">
<m:content>
<m:Table bindingContexts="complex" id="sap_Responsive_Page_0-content-build_simple_Table-1491380108675" width="100%" mode="None" showSeparators="None" growing="false"
growingThreshold="20" fixedLayout="true" growingScrollToLoad="false" items="{path:'/DCSet'}">
<m:columns >
<m:Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Tablet" demandPopin="true" popinDisplay="Inline" mergeDuplicates="true">
<m:header>
<m:Text text="Cahier des charges" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
</m:header>
<m:footer/>
</m:Column>
<m:Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Tablet" demandPopin="true" popinDisplay="Inline" mergeDuplicates="true">
<m:header>
<m:Text text="instruction" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
</m:header>
<m:footer/>
</m:Column>
</m:columns>
<m:items>
<m:ColumnListItem id ="col" type="Inactive">
<m:StandardTile title="{label}" number="{ID}" numberUnit="{typeeq}" info="{typedem}" infoState="None" icon="sap-icon://pushpin-off"
press="_onStandardTilePress1"/>
<m:StandardTile title="{label}" number="{ID}" numberUnit="{typeeq}" info="{typedem}" infoState="Error" icon="sap-icon://pushpin-off"
press="_onStandardTilePress1"/>
</m:ColumnListItem>
</m:items>
</m:Table>
</m:content>
<m:headerContent/>
<m:subHeader/>
<m:customHeader/>
</m:Page>
我的Json文件
[
{
"ID": "30615",
"label": "Label1",
"col": "col1"
},
{
"ID": "31107",
"label": "Label2",
"col": "col2"
},
{
"ID": "31109",
"label": "Label3",
"col": "col1"
},
{
"ID": "34567",
"col": "col2",
"label": "Label4"
},
{
"ID": "21456",
"col": "col1",
"label": "Label5"
},
{
"ID": "22345",
"col": "col2",
"label": "Label6"
}
]
我的要求非常简单,如果我的Json文件中的“col”属性等于“col1”,那么将该项放在我的表的第一列中,否则如果它等于“col2”则将其放在第二列中。是否可以在XML中执行此操作?
提前致谢。
答案 0 :(得分:0)
尽管我理解这个问题 - Expression binding可以帮到你。
答案 1 :(得分:0)
正如Martin所建议的那样,您可以在StandardTile的“visible”属性上尝试Expression绑定。