2015-04-15 31 views
0

我想創建一個頁面,需要一個面板與過濾列表裏面。面板內SAPUI5過濾列表

我以前是「組」和「系統」單獨的JSON文件,但是然後將它們合併爲一個。

這是我的新的JSON文件:

{ 
    "TECHOPSSet" : [ 
    { 
     "GROUP" : "1", 
     "SYSTEMS": [ 
      { 
       "SysID" : "sys1", 
       "SysDesc" : "System1", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "3", 
       "Configuration" : "2" 
      } 
     ] 
    }, 
    { 
     "GROUP" : "2", 
     "SYSTEMS": [ 
      { 
       "SysID" : "sys2", 
       "SysDesc" : "System2", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "3", 
       "Configuration" : "2" 
      }, 
         { 
       "SysID" : "sys3", 
       "SysDesc" : "System3", 
       "Availability" : "2", 
       "Performance" : "1", 
       "Exception" : "2", 
       "Configuration" : "3" 
      } 
     ] 
    },  
    { 
     "GROUP" : "3", 
     "SYSTEMS": [ 
      { 
       "SysID" : "sys4", 
       "SysDesc" : "System4", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "1", 
       "Configuration" : "1" 
      }, 
      { 
       "SysID" : "sys5", 
       "SysDesc" : "System5", 
       "Availability" : "2", 
       "Performance" : "2", 
       "Exception" : "3", 
       "Configuration" : "1" 
      }, 
      { 
       "SysID" : "sys6", 
       "SysDesc" : "System6", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "2", 
       "Configuration" : "3" 
      } 
     ] 
    },  
    { 
     "GROUP" : "4", 
     "SYSTEMS": [ 
      { 
       "SysID" : "sys7", 
       "SysDesc" : "System7", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "3", 
       "Configuration" : "2" 
      } 
     ] 
    }, 
     { 
     "GROUP" : "5", 
     "SYSTEMS": [ 
      { 
       "SysID" : "sys8", 
       "SysDesc" : "System8", 
       "Availability" : "1", 
       "Performance" : "1", 
       "Exception" : "3", 
       "Configuration" : "2" 
      } 
     ] 
    } 
    ] 
} 

這裏是我做不工作的視圖的片段。我認爲必須有「物品路徑」,但我不知道如何解決它。

<core:FragmentDefinition xmlns:l="sap.ui.layout" 
xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns="sap.m"> 

<List id="homelistID" items="{ path: '/TECHOPSSet/GROUP' }" > 
    <items> 
     <CustomListItem type="Inactive"> 
      <Panel id="homePanelID" expandable="true" expanded="false" headerText="{GROUP}"> 
       <Toolbar height="2rem"> 
        <Text text="Technical" /> 
        <ToolbarSpacer /> 
        <Text text="Monitoring" /> 
        <ToolbarSpacer /> 
        <Text text="Business" /> 
       </Toolbar> 
        <List id="techopsListID" items="{ path: '/TECHOPSSet/SYSTEMS'}"> 
         <items> 
          <CustomListItem type="Active"> 
           <l:HorizontalLayout> 
            <Image src="{parts: ['Availability', 'Performance', 'Exception'] , formatter: 'sap.ui.proj.util.Formatter.techMonSummary'}" /> 
            <Text text="{SysDesc}" /> 
            <!--<Image src="{parts: ['enter BizOps parts here'] , formatter: 'sap.ui.proj.util.Formatter.bizMonSummary'}" /> --> 
           </l:HorizontalLayout> 
          </CustomListItem> 
         </items> 
        </List> 
      </Panel> 
     </CustomListItem> 
    </items> 
</List> 

這裏是我的控制器中的一個片段:

onInit : function() { 
    var homePage = this.getView().byId("homePage"); 

    var oPanelGroup = new sap.ui.model.json.JSONModel(
      "model/panelgroup.json"); 
    var oPanelItems = new sap.ui.model.json.JSONModel(
      "model/TECHOPSSet.json"); 

    var HomePanel = sap.ui.xmlfragment("sap.ui.proj.fragment.HomePanel"); 

    //  sap.ui.getCore().byId("homelistID").setModel(oPanelGroup); 
    sap.ui.getCore().byId("homelistID").setModel(oPanelItems); 
    console.log(oPanelGroup); 

    sap.ui.getCore().byId("techopsListID").setModel(oPanelItems); 
    console.log(oPanelItems); 

    homePage.addContent(HomePanel); 
    }, 

所以基本上,我如何以這樣的方式實現這SAPUI5的「組」是面板和「系統」是該面板中的列表?

回答

0

將第一個列表的路徑改爲「{path:'/ TECHOPSSet'}」,將第二個路徑的路徑改爲「{path:'SYSTEMS'}。如果沒有進一步的設置應用於綁定,可以使用縮寫形式,如「{}系統」。 還有一個提示。而不是模型設置爲你可以利用一個事實,即屬性將自動傳播到子組件的每個控制的。

var view = this.getView(); 
view.setModel(oPanelItems); 
view.addDependent(HomePanel);