2017-04-11 50 views
1

我在那里,我从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文件等于“COL1”号,如果“关口”属性将项目放在我表格的第一列,否则如果它等于“col2”,则将它放在第二列。是否有可能在XML中做到这一点?

在此先感谢。

+0

我很难理解这个问题。 你说只有一个单元格按行显示。 如果您然后压缩这些项目并删除所有空单元格,是不是所有可见单元格都在第一列? 也许它有帮助,如果你请发布你的更新的视图文件,你使用了tile标签的可见属性和 表格的当前外观的屏幕截图? –

回答

0

正如Martin所建议的那样,您可以在StandardTile的“visible”属性上尝试Expression绑定。

+0

感谢您的回复。我使用了tile标签的visible属性,但是当我这样做时,只有一个单元格按行显示。 你有任何想法如何浓缩项目,以删除所有空单元格? 在此先感谢..... – user3510821