动态更改控制器UI5中片段中的路径

时间:2017-07-28 20:39:34

标签: sapui5

我有一个片段如下,路径:myModel1> / 1 / TileCollection但是我想让它像myModel1> / n / TileCollection这样的控制器动态,就像n可以是0到1000。

<core:FragmentDefinition xmlns="sap.m"
    xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
    xmlns:html="http://www.w3.org/1999/xhtml" xmlns:l="sap.ui.layout">
 <Page id="master22" showHeader="false" enableScrolling="true" >    
     <TileContainer
      id="container">
       tiles="{myModel1>/1/TileCollection}">   
      <StandardTile      
        icon="{myModel1>icon}"  
        number="{myModel1>number}"
        numberUnit="{myModel1>numberUnit}"
        title="{myModel1>title}"
        info="{myModel1>info}"
        infoState="{myModel1>infoState}" 
        press="handleTilePress"/>  
       </TileContainer>  
       </Page> 
</core:FragmentDefinition>

JSON字符串: 当类型键为0时,我想要不同的瓦片组,当它为1时,不同的瓦片......类似地继续...

[{
        "type": "01",
        "typeKey": "0",
  "TileCollection" : [
    {
      "id-tile": "1AP",
      "icon" : "sap-icon://inbox",
      "number" : "899999",
      "title" : "Accounting Documents",
      "info" : "Overdue",
      "infoState" : "Error",
       "press" :  "sayAlert"
    },
    {
     "id-tile": "2AP",
      "type" : "sap-icon://Create",
       "number" : "57899",
      "title" : "Pending Invoices",
      "info" : "28 Days Left",
      "infoState" : "Success"
    }]

            }, {
                "type": "02",
                "typeKey": "1",
                 "TileCollection" : [
    {
      "id-tile": "3AP",
      "icon" : "sap-icon://inbox",
      "number" : "899999",
      "title" : "MERCHPAY IDOCs",
      "info" : "Overdue",
      "infoState" : "Error",
       "press" :  "sayAlert"
    },
    {
     "id-tile": "4AP",
      "type" : "sap-icon://Create",
       "number" : "57899",
      "title" : "Pending Invoices",
      "info" : "28 Days Left",
      "infoState" : "Success"
    }]
               }]

0 个答案:

没有答案