2017-10-20 8 views
0

하위 "질문"(입력란)이 포함 된 패널 (카테고리)이 있습니다.SAPUI5 - _each 루프로 내용 렌더링 문제

패널이 잘 표시되지만 각 패널 내용 : 속성에 더 많은 질문이 포함될 수 있습니다.

var oPanel = new sap.m.Panel({ 
      expandable: true, 
      expanded: false, 
      headerText: oData.results[0].CategoryDesc, 
      id: "Panel" + index, 
      content: _.each(oViewData.categories, function(result, index2) { 
       new sap.m.Input("iCategory" + index + index2, {    
      }); 
     }) 
    }); 
    oPanel.placeAt("panelContent"); 

데이터를 올바르게 가져 오지만 내용이 렌더링되지 않습니다. 오류 메시지가 나타납니다.

The renderer for class sap.ui.core.Control is not defined or does not define a render function! Rendering of __control0 will be skipped! - 

content 속성에 _each (밑줄)를 사용할 수 있습니까? 그렇지 않다면 내 대안은 무엇입니까?

답변

1

당신은 배열에 데이터를 밀어 컨텐츠 영역에서 사용할 수 있습니다 : addContent으로 해결

var oPanelContent = []; 

_.each(oViewData.categories, function(result, index2) { 
    oPanelContent.push(new sap.m.Input("iCategory" + index + index2, {    
    }) 
); 


var oPanel = new sap.m.Panel({ 
      expandable: true, 
      expanded: false, 
      headerText: oData.results[0].CategoryDesc, 
      id: "Panel" + index, 
      content: oPanelContent 
     }) 
    }); 
    oPanel.placeAt("panelContent"); 
+0

:) –