【发布时间】:2017-04-11 22:20:27
【问题描述】:
我有这个 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 中做到这一点?
提前致谢。
【问题讨论】:
-
我很难理解这个问题。你说只有一个单元格按行显示。如果然后压缩项目并删除所有空单元格,所有可见单元格不会都在第一列吗?如果您发布更新的视图文件,您在其中使用了 tile 标签的可见属性和当前表格外观的屏幕截图,也许会有所帮助?