2014-11-27 9 views
2

다중 모델 바인딩에 문제가 있습니다. 컨트롤러의 초기화 기능에서SAPUI5 다중 모델 바인딩

내가

var oModel = new sap.ui.model.json.JSONModel(data1); 
sap.ui.getCore().setModel(oModel, "model1"); 

보기에 내가 ColumnListItem의 템플릿을 가지고 있고 간단한 모델로 테이블

var template = new sap.m.ColumnListItem({ 
      id: "first_template", 
      type: "Navigation", 
      type : sap.m.ListType.Active, 
      visible: true, 
      selected: true, 
      cells: [ new sap.m.Label({ 
        text: "{name}" 
        }) 
      ], 
      press: [oController.pressListMethod] 


    }); 

    oTable.bindItems("model1>/events", template, null, null); 
    oPage.addContent(oTable); 

에 바인딩 ui.core에서 JSON 모델을 설정하여 작품의 rigth하지만 Multimodel 테이블에서만 항목의 수를 얻을 수 있지만 모델의 속성은 가져 오지 않습니다. 어떤 해결책?

답변

2

당신도 템플릿에 모델 이름을 사용해야합니다 :

var template = new sap.m.ColumnListItem({ 
    id: "first_template", 
    type: "Navigation", 
    type : sap.m.ListType.Active, 
    visible: true, 
    selected: true, 
    cells: [ 
    new sap.m.Label({ 
     text: "{model1>name}" // No leading "/" here since the binding is relative to the aggregation binding below 
    }) 
    ], 
    press: oController.pressListMethod 
}); 

oTable.bindItems("model1>/events", template); 
oPage.addContent(oTable); 
관련 문제